Sha256: d38c9264b73ef8a9b45b335c59790de45c02596a259ab4db4f3bbc05e6f047f2

Contents?: true

Size: 1.13 KB

Versions: 3

Compression:

Stored size: 1.13 KB

Contents

module Rollbar
  # Report any uncaught errors in a job to Rollbar and reraise
  module ActiveJob
    def self.included(base)
      base.send :rescue_from, Exception do |exception|
        args = if self.class.respond_to?(:log_arguments?) && !self.class.log_arguments?
                 arguments.map(&Rollbar::Scrubbers.method(:scrub_value))
               else
                 arguments
               end

        Rollbar.error(exception,
                      :job => self.class.name,
                      :job_id => job_id,
                      :use_exception_level_filters => true,
                      :arguments => args)
        raise exception
      end
    end
  end
end

if defined?(ActiveSupport) && ActiveSupport.respond_to?(:on_load)
  ActiveSupport.on_load(:action_mailer) do
    # Automatically add to ActionMailer::DeliveryJob
    if defined?(ActionMailer::DeliveryJob)
      ActionMailer::DeliveryJob.send(:include,
                                     Rollbar::ActiveJob)
    end
    # Rails >= 6.0
    if defined?(ActionMailer::MailDeliveryJob)
      ActionMailer::MailDeliveryJob.send(:include, Rollbar::ActiveJob)
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
rollbar-3.4.2 lib/rollbar/plugins/active_job.rb
rollbar-3.4.1 lib/rollbar/plugins/active_job.rb
rollbar-3.4.0 lib/rollbar/plugins/active_job.rb