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) 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)
  Airbrake::Rack::NoticeBuilder.new(request.env).build_notice(exception)
end
notify_airbrake(exception, parameters = {}, notifier = :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, parameters = {}, notifier = :default)
  return unless (notice = build_notice(exception))
  Airbrake.notify(notice, parameters, notifier)
end
notify_airbrake_sync(exception, parameters = {}, notifier = :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, parameters = {}, notifier = :default)
  return unless (notice = build_notice(exception))
  Airbrake.notify_sync(notice, parameters, notifier)
end