Sha256: 2f814572f336ad958269e77df3144128a3f7a5b181e165590697539f7559700d

Contents?: true

Size: 1.04 KB

Versions: 52

Compression:

Stored size: 1.04 KB

Contents

module Honeybadger
  module Rails
    module Middleware
      module ExceptionsCatcher
        def self.included(base)
          base.send(:alias_method_chain,:render_exception,:honeybadger)
        end

        def skip_user_agent?(env)
          user_agent = env["HTTP_USER_AGENT"]
          ::Honeybadger.configuration.ignore_user_agent.flatten.any? { |ua| ua === user_agent }
        rescue
          false
        end

        def render_exception_with_honeybadger(env,exception)
          controller = env['action_controller.instance']
          env['honeybadger.error_id'] = Honeybadger.
            notify_or_ignore(exception,
                   (controller.respond_to?(:honeybadger_request_data) ? controller.honeybadger_request_data : {:rack_env => env})) unless skip_user_agent?(env)
          if defined?(controller.rescue_action_in_public_without_honeybadger)
            controller.rescue_action_in_public_without_honeybadger(exception)
          end
          render_exception_without_honeybadger(env,exception)
        end
      end
    end
  end
end

Version data entries

52 entries across 52 versions & 1 rubygems

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