Sha256: f256e53e6623cff21ddbd66c807b92406397a48b8a7c0e10a088e76915254cb5

Contents?: true

Size: 941 Bytes

Versions: 17

Compression:

Stored size: 941 Bytes

Contents

module Airbrake
  module Rails
    # Enables support for exceptions occurring in ActiveJob jobs.
    module ActiveJob
      extend ActiveSupport::Concern

      # @return [Array<Regexp>] the list of known adapters
      ADAPTERS = [/Resque/, /Sidekiq/, /DelayedJob/].freeze

      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].merge!(job.serialize)
        end

        raise exception
      end

      included do
        rescue_from(Exception) do |exception|
          Airbrake::Rails::ActiveJob.notify_airbrake(exception, self)
        end
      end
    end
  end
end

Version data entries

17 entries across 17 versions & 1 rubygems

Version Path
airbrake-8.1.4 lib/airbrake/rails/active_job.rb
airbrake-8.1.3 lib/airbrake/rails/active_job.rb
airbrake-8.1.2 lib/airbrake/rails/active_job.rb
airbrake-8.1.1 lib/airbrake/rails/active_job.rb
airbrake-8.1.0 lib/airbrake/rails/active_job.rb
airbrake-8.0.1 lib/airbrake/rails/active_job.rb
airbrake-8.0.0 lib/airbrake/rails/active_job.rb
airbrake-8.0.0.rc.9 lib/airbrake/rails/active_job.rb
airbrake-8.0.0.rc.8 lib/airbrake/rails/active_job.rb
airbrake-8.0.0.rc.7 lib/airbrake/rails/active_job.rb
airbrake-8.0.0.rc.6 lib/airbrake/rails/active_job.rb
airbrake-8.0.0.rc.5 lib/airbrake/rails/active_job.rb
airbrake-8.0.0.rc.3 lib/airbrake/rails/active_job.rb
airbrake-8.0.0.rc.2 lib/airbrake/rails/active_job.rb
airbrake-7.5.0.pre.1 lib/airbrake/rails/active_job.rb
airbrake-7.4.0 lib/airbrake/rails/active_job.rb
airbrake-7.3.5 lib/airbrake/rails/active_job.rb