module Airbrake::Rails::ActiveJob

Enables support for exceptions occurring in ActiveJob jobs.

Constants

ADAPTERS

@return [Array<Regexp>] the list of known adapters

Public Class Methods

notify_airbrake(exception, job) click to toggle source
# File lib/airbrake/rails/active_job.rb, line 10
def self.notify_airbrake(exception, job)
  queue_adapter = job.class.queue_adapter.to_s

  # Do not notify twice if a queue_adapter is configured already.
  raise exception if ADAPTERS.any? { |a| a =~ queue_adapter }

  notice = Airbrake.build_notice(exception)
  notice[:context][:component] = 'active_job'
  notice[:context][:action] = job.class.name
  notice[:params].merge!(job.serialize)

  Airbrake.notify(notice)

  raise exception
end