Skip to content

Commit 580e7f4

Browse files
committed
[active_job] dry-up capturing logic a bit
1 parent 8539224 commit 580e7f4

File tree

1 file changed

+8
-6
lines changed

1 file changed

+8
-6
lines changed

sentry-rails/lib/sentry/rails/active_job.rb

+8-6
Original file line numberDiff line numberDiff line change
@@ -18,9 +18,7 @@ def already_supported_by_sentry_integration?
1818
end
1919

2020
def retry_job(error:, **opts)
21-
unless Sentry.configuration.rails.active_job_report_after_job_retries
22-
SentryReporter.capture_exception(self, error)
23-
end
21+
SentryReporter.maybe_capture_exception(self, error)
2422
super
2523
end
2624

@@ -54,15 +52,19 @@ def record(job, &block)
5452
rescue Exception => e # rubocop:disable Lint/RescueException
5553
finish_sentry_transaction(transaction, 500)
5654

57-
unless Sentry.configuration.rails.active_job_report_after_job_retries
58-
capture_exception(job, e)
59-
end
55+
maybe_capture_exception(job, e)
6056

6157
raise
6258
end
6359
end
6460
end
6561

62+
def maybe_capture_exception(job, e)
63+
unless Sentry.configuration.rails.active_job_report_after_job_retries
64+
capture_exception(job, e)
65+
end
66+
end
67+
6668
def capture_exception(job, e)
6769
Sentry::Rails.capture_exception(
6870
e,

0 commit comments

Comments
 (0)