Module: Honeybadger::Plugins::Rails::ExceptionsCatcher Private

Defined in:
lib/honeybadger/plugins/rails.rb

This module is part of a private API. You should avoid using this module if possible, as it may be removed or be changed in the future.

Instance Method Summary collapse

Instance Method Details

#render_exception(arg, exception) ⇒ Object

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Adds additional Honeybadger info to Request env when an exception is rendered in Rails' middleware.

Parameters:

  • arg (Hash, ActionDispatch::Request)

    The Rack env Hash in Rails 3.0-4.2. After Rails 5 arg is an ActionDispatch::Request.

  • exception (Exception)

    The error which was rescued.

Returns:

  • The super value of the middleware's #render_exception() method.


16
17
18
19
20
21
22
23
24
25
26
27
28
29
# File 'lib/honeybadger/plugins/rails.rb', line 16

def render_exception(arg, exception)
  if arg.kind_of?(::ActionDispatch::Request)
    request = arg
    env = request.env
  else
    request = ::Rack::Request.new(arg)
    env = arg
  end

  env['honeybadger.exception'] = exception
  env['honeybadger.request.url'] = request.url rescue nil

  super(arg, exception)
end