Skip to content

Commit

Permalink
move Rollbar::ActiveJob out of the plugin (#1149)
Browse files Browse the repository at this point in the history
  • Loading branch information
waltjones committed Jan 16, 2024
1 parent 063b416 commit bf3b921
Showing 1 changed file with 33 additions and 33 deletions.
66 changes: 33 additions & 33 deletions lib/rollbar/plugins/active_job.rb
Original file line number Diff line number Diff line change
@@ -1,45 +1,45 @@
Rollbar.plugins.define('active_job') do
dependency { !configuration.disable_monkey_patch }
dependency { !configuration.disable_action_mailer_monkey_patch }
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|
job_data = {
:job => self.class.name,
:use_exception_level_filters => true
}

execute do
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|
job_data = {
:job => self.class.name,
:use_exception_level_filters => true
}
# When included in ActionMailer, the handler is called twice.
# This detects the execution that has the expected state.
if defined?(ActionMailer::Base) && self.class.ancestors.include?(ActionMailer::Base)
job_data[:action] = action_name
job_data[:params] = @params

# When included in ActionMailer, the handler is called twice.
# This detects the execution that has the expected state.
if defined?(ActionMailer::Base) && self.class.ancestors.include?(ActionMailer::Base)
job_data[:action] = action_name
job_data[:params] = @params
Rollbar.error(exception, job_data)

Rollbar.error(exception, job_data)

# This detects other supported integrations.
elsif defined?(arguments)
job_data[:arguments] = \
if self.class.respond_to?(:log_arguments?) && !self.class.log_arguments?
arguments.map(&Rollbar::Scrubbers.method(:scrub_value))
else
arguments
end
job_data[:job_id] = job_id if defined?(job_id)

Rollbar.error(exception, job_data)
# This detects other supported integrations.
elsif defined?(arguments)
job_data[:arguments] = \
if self.class.respond_to?(:log_arguments?) && !self.class.log_arguments?
arguments.map(&Rollbar::Scrubbers.method(:scrub_value))
else
arguments
end
job_data[:job_id] = job_id if defined?(job_id)

raise exception
end
Rollbar.error(exception, job_data)
end

raise exception
end
end
end
end

Rollbar.plugins.define('active_job') do
dependency { !configuration.disable_monkey_patch }
dependency { !configuration.disable_action_mailer_monkey_patch }

execute do
if defined?(ActiveSupport) && ActiveSupport.respond_to?(:on_load)
ActiveSupport.on_load(:action_mailer) do
if defined?(ActionMailer::MailDeliveryJob) # Rails >= 6.0
Expand Down

0 comments on commit bf3b921

Please sign in to comment.