Sha256: b43dc2068003927dc385780e57c4eaed758373ef78b008742080b7045fd9f9a1

Contents?: true

Size: 1.11 KB

Versions: 2

Compression:

Stored size: 1.11 KB

Contents

module CrashLog
  module Rails

    # CrashLog 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)
        crash_log.auto_notify(exception, crash_log_context)
        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)
        crash_log.auto_notify(exception, crash_log_context)
        rescue_action_locally_without_crash_log(exception)
      end
    end
  end

end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
crashlog-1.0.0.rc1 lib/crash_log/rails/action_controller_rescue.rb
crashlog-0.0.2 lib/crash_log/rails/action_controller_rescue.rb