module Airbrake::Rails::ActionController
Contains helper methods that can be used inside Rails
controllers to send notices to Airbrake
. The main benefit of using them instead of the direct API is that they automatically add information from the Rack
environment to notices.
Private Instance Methods
build_notice(exception, params = {}, notifier_name = :default)
click to toggle source
@param [Exception] exception @return [Airbrake::Notice] the notice with information from the Rack
env
# File lib/airbrake/rails/action_controller.rb, line 32 def build_notice(exception, params = {}, notifier_name = :default) return unless (notice = Airbrake[notifier_name].build_notice(exception, params)) notice.stash[:rack_request] = request notice end
notify_airbrake(exception, params = {}, notifier_name = :default)
click to toggle source
A helper method for sending notices to Airbrake
asynchronously. Attaches information from the Rack
env. @see Airbrake#notify, notify_airbrake_sync
# File lib/airbrake/rails/action_controller.rb, line 15 def notify_airbrake(exception, params = {}, notifier_name = :default) return unless (notice = build_notice(exception, params, notifier_name)) Airbrake[notifier_name].notify(notice, params) end
notify_airbrake_sync(exception, params = {}, notifier_name = :default)
click to toggle source
A helper method for sending notices to Airbrake
synchronously. Attaches information from the Rack
env. @see Airbrake#notify_sync, notify_airbrake
# File lib/airbrake/rails/action_controller.rb, line 24 def notify_airbrake_sync(exception, params = {}, notifier_name = :default) return unless (notice = build_notice(exception, params, notifier_name)) Airbrake[notifier_name].notify_sync(notice, params) end