Sha256: 67852fab0a29f5d83b23f26b426e37b266fea3be28d3228ef4c3fa2839fab630

Contents?: true

Size: 984 Bytes

Versions: 5

Compression:

Stored size: 984 Bytes

Contents

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

      included do
        if ::Rails.application.config.respond_to?(:active_job)
          active_job_cfg = ::Rails.application.config.active_job
          is_resque_adapter = (active_job_cfg.queue_adapter == :resque)
        end

        rescue_from(Exception) do |exception|
          next unless (notice = Airbrake.build_notice(exception))

          notice[:context][:component] = 'active_job'
          notice[:context][:action] = self.class.name

          notice[:params] = as_json

          # We special case Resque because it kills our workers by forking, so
          # we use synchronous delivery instead.
          if is_resque_adapter
            Airbrake.notify_sync(notice)
          else
            Airbrake.notify(notice)
          end

          raise exception
        end
      end
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
airbrake-5.4.3 lib/airbrake/rails/active_job.rb
airbrake-5.4.2 lib/airbrake/rails/active_job.rb
airbrake-5.4.1 lib/airbrake/rails/active_job.rb
airbrake-5.4.0 lib/airbrake/rails/active_job.rb
airbrake-5.3.0 lib/airbrake/rails/active_job.rb