Sha256: be5547de0f1f15b2fc35da3f1b55c5a92981f604d370c823b0a7af7b975a1a67

Contents?: true

Size: 1.24 KB

Versions: 54

Compression:

Stored size: 1.24 KB

Contents

module Honeybadger
  module Rails
    module ActionControllerCatcher

      # Sets up an alias chain to catch exceptions when Rails does
      def self.included(base) #:nodoc:
        base.send(:alias_method, :rescue_action_in_public_without_honeybadger, :rescue_action_in_public)
        base.send(:alias_method, :rescue_action_in_public, :rescue_action_in_public_with_honeybadger)
      end

      private

      # Overrides the rescue_action method in ActionController::Base, but does not inhibit
      # any custom processing that is defined with Rails 2's exception helpers.
      def rescue_action_in_public_with_honeybadger(exception)
        unless honeybadger_ignore_user_agent?
          error_id = Honeybadger.notify_or_ignore(exception, honeybadger_request_data)
          request.env['honeybadger.error_id'] = error_id
        end
        rescue_action_in_public_without_honeybadger(exception)
      end

      def honeybadger_ignore_user_agent? #:nodoc:
        # Rails 1.2.6 doesn't have request.user_agent, so check for it here
        user_agent = request.respond_to?(:user_agent) ? request.user_agent : request.env["HTTP_USER_AGENT"]
        Honeybadger.configuration.ignore_user_agent.flatten.any? { |ua| ua === user_agent }
      end
    end
  end
end

Version data entries

54 entries across 54 versions & 1 rubygems

Version Path
honeybadger-1.16.7 lib/honeybadger/rails/action_controller_catcher.rb
honeybadger-1.16.6 lib/honeybadger/rails/action_controller_catcher.rb
honeybadger-1.16.5 lib/honeybadger/rails/action_controller_catcher.rb
honeybadger-1.16.4 lib/honeybadger/rails/action_controller_catcher.rb
honeybadger-1.16.3 lib/honeybadger/rails/action_controller_catcher.rb
honeybadger-1.16.2 lib/honeybadger/rails/action_controller_catcher.rb
honeybadger-1.16.1 lib/honeybadger/rails/action_controller_catcher.rb
honeybadger-1.16.0 lib/honeybadger/rails/action_controller_catcher.rb
honeybadger-1.15.3 lib/honeybadger/rails/action_controller_catcher.rb
honeybadger-1.15.2 lib/honeybadger/rails/action_controller_catcher.rb
honeybadger-1.15.1 lib/honeybadger/rails/action_controller_catcher.rb
honeybadger-1.15.0 lib/honeybadger/rails/action_controller_catcher.rb
honeybadger-1.14.0 lib/honeybadger/rails/action_controller_catcher.rb
honeybadger-1.13.2 lib/honeybadger/rails/action_controller_catcher.rb
honeybadger-1.13.1 lib/honeybadger/rails/action_controller_catcher.rb
honeybadger-1.13.0 lib/honeybadger/rails/action_controller_catcher.rb
honeybadger-1.12.0.beta3 lib/honeybadger/rails/action_controller_catcher.rb
honeybadger-1.12.0.beta2 lib/honeybadger/rails/action_controller_catcher.rb
honeybadger-1.11.2 lib/honeybadger/rails/action_controller_catcher.rb
honeybadger-1.11.1 lib/honeybadger/rails/action_controller_catcher.rb