Sha256: 4c5c052db674e445e4bd106e858875766553d60d4e0e489401938c8fa4c23b87

Contents?: true

Size: 1010 Bytes

Versions: 20

Compression:

Stored size: 1010 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|
          if (notice = Airbrake.build_notice(exception))
            notice[:context][:component] = 'active_job'
            notice[:context][:action] = self.class.name

            notice[:params] = serialize

            # 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
          end

          raise exception
        end
      end
    end
  end
end

Version data entries

20 entries across 20 versions & 2 rubygems

Version Path
airbrake-6.2.1 lib/airbrake/rails/active_job.rb
airbrake-6.2.0 lib/airbrake/rails/active_job.rb
airbrake-6.1.2 lib/airbrake/rails/active_job.rb
airbrake-6.1.1 lib/airbrake/rails/active_job.rb
airbrake-6.1.0 lib/airbrake/rails/active_job.rb
airbrake-6.1.0.rc.1 lib/airbrake/rails/active_job.rb
airbrake-6.0.0 lib/airbrake/rails/active_job.rb
airbrake-5.8.1 lib/airbrake/rails/active_job.rb
airbrake-5.8.0 lib/airbrake/rails/active_job.rb
airbrake-5.8.0.rc.3 lib/airbrake/rails/active_job.rb
airbrake-5.8.0.rc.2 lib/airbrake/rails/active_job.rb
airbrake-5.8.0.rc.1 lib/airbrake/rails/active_job.rb
airbrake-5.7.1 lib/airbrake/rails/active_job.rb
airbrake-5.7.0 lib/airbrake/rails/active_job.rb
airbrake-5.7.0.rc.1 lib/airbrake/rails/active_job.rb
dfg-airbrake-5.6.2 lib/airbrake/rails/active_job.rb
airbrake-5.6.1 lib/airbrake/rails/active_job.rb
airbrake-5.6.0 lib/airbrake/rails/active_job.rb
airbrake-5.5.0 lib/airbrake/rails/active_job.rb
airbrake-5.4.5 lib/airbrake/rails/active_job.rb