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 12
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 }

  Airbrake.notify(exception) do |notice|
    notice[:context][:component] = 'active_job'
    notice[:context][:action] = job.class.name
    notice[:params] = job.serialize
  end

  raise exception
end