Module: RocketPants::Rescuable

Extended by:
ActiveSupport::Concern
Includes:
ActiveSupport::Rescuable
Defined in:
lib/rocket_pants/controller/rescuable.rb

Overview

An alternative to Rail’s built in ActionController::Rescue module, tailored to deeply integrate rescue notififers into the application.

Thus, it is relatively simple to

Defined Under Namespace

Modules: ClassMethods

Constant Summary collapse

DEFAULT_NOTIFIER_CALLBACK =
lambda do |controller, exception, req|
  # Does nothing
end
NAMED_NOTIFIER_CALLBACKS =
{
  :airbrake => lambda { |c, e, r|
    unless c.send(:airbrake_local_request?)
      c.error_identifier = Airbrake.notify(e, c.send(:airbrake_request_data))
    end
  },
  :honeybadger => lambda { |controller, exception, request|
    if controller.respond_to?(:notify_honeybadger, true)
      controller.send(:notify_honeybadger, exception)
    end
  },
  :bugsnag => lambda { |controller, exception, request|
    controller.send(:notify_bugsnag, exception, request: request)
  }
}

Instance Method Summary collapse

Instance Method Details

#lookup_error_extras(exception) ⇒ Object

Overrides the lookup_error_extras method to also include an error_identifier field to be sent back to the client.



50
51
52
53
54
# File 'lib/rocket_pants/controller/rescuable.rb', line 50

def lookup_error_extras(exception)
  extras = super
  extras = extras.merge(:error_identifier => error_identifier) if error_identifier
  extras
end