Sha256: d2f9ca914515b14906139f55bfe739237189511e2a127bc94a1454b54004fe79

Contents?: true

Size: 1.16 KB

Versions: 9

Compression:

Stored size: 1.16 KB

Contents

module CrashLog
  module Rails

    # CrashLog Rails 2.x controller integration
    # Aliases method chain for Rails internal rescue action
    module ActionControllerRescue
      def self.included(base)
        base.send(:alias_method, :rescue_action_in_public_without_crash_log, :rescue_action_in_public)
        base.send(:alias_method, :rescue_action_in_public, :rescue_action_in_public_with_crash_log)

        base.send(:alias_method, :rescue_action_locally_without_crash_log, :rescue_action_locally)
        base.send(:alias_method, :rescue_action_locally, :rescue_action_locally_with_crash_log)
      end

    private

      # crash_log_context is defined in controller_methods.rb
      def rescue_action_in_public_with_crash_log(exception)
        CrashLog.notify_or_ignore(exception, crash_log_context)
      ensure
        rescue_action_in_public_without_crash_log(exception)
      end

      # crash_log_context is defined in controller_methods.rb
      def rescue_action_locally_with_crash_log(exception)
        CrashLog.notify_or_ignore(exception, crash_log_context)
      ensure
        rescue_action_locally_without_crash_log(exception)
      end
    end
  end

end

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
crashlog-1.1.0.pre1 lib/crash_log/rails/action_controller_rescue.rb
crashlog-1.0.7 lib/crash_log/rails/action_controller_rescue.rb
crashlog-1.0.6 lib/crash_log/rails/action_controller_rescue.rb
crashlog-1.0.5 lib/crash_log/rails/action_controller_rescue.rb
crashlog-1.0.4 lib/crash_log/rails/action_controller_rescue.rb
crashlog-1.0.3 lib/crash_log/rails/action_controller_rescue.rb
crashlog-1.0.2.1 lib/crash_log/rails/action_controller_rescue.rb
crashlog-1.0.2 lib/crash_log/rails/action_controller_rescue.rb
crashlog-1.0.1 lib/crash_log/rails/action_controller_rescue.rb