Sha256: 18c4b4c1e953c2036e9ec00add53e5152ff2ee35df60941e4a590ea84f6c9f32

Contents?: true

Size: 1.2 KB

Versions: 7

Compression:

Stored size: 1.2 KB

Contents

# Rails 2.x only
module Bugsnag::Rails
  module ActionControllerRescue
    def self.included(base)
      # Hook into rails exception rescue stack
      base.send(:alias_method, :rescue_action_in_public_without_bugsnag, :rescue_action_in_public)
      base.send(:alias_method, :rescue_action_in_public, :rescue_action_in_public_with_bugsnag)

      base.send(:alias_method, :rescue_action_locally_without_bugsnag, :rescue_action_locally)
      base.send(:alias_method, :rescue_action_locally, :rescue_action_locally_with_bugsnag)

      # Run filters on requests to capture request data
      base.send(:before_filter, :set_bugsnag_request_data)
      base.send(:after_filter, :clear_bugsnag_request_data)
    end

    private
    def set_bugsnag_request_data
      Bugsnag.set_request_data(:rails2_request, request)
    end
    
    def clear_bugsnag_request_data
      Bugsnag.clear_request_data
    end

    def rescue_action_in_public_with_bugsnag(exception)
      Bugsnag.auto_notify(exception)

      rescue_action_in_public_without_bugsnag(exception)
    end

    def rescue_action_locally_with_bugsnag(exception)
      Bugsnag.auto_notify(exception)

      rescue_action_locally_without_bugsnag(exception)
    end
  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
bugsnag-1.2.5 lib/bugsnag/rails/action_controller_rescue.rb
bugsnag-1.2.4 lib/bugsnag/rails/action_controller_rescue.rb
bugsnag-1.2.3 lib/bugsnag/rails/action_controller_rescue.rb
bugsnag-1.2.2 lib/bugsnag/rails/action_controller_rescue.rb
bugsnag-1.2.1 lib/bugsnag/rails/action_controller_rescue.rb
bugsnag-1.2.0 lib/bugsnag/rails/action_controller_rescue.rb
bugsnag-1.2.0.beta lib/bugsnag/rails/action_controller_rescue.rb