Skip to content

Commit

Permalink
Return value of rescue_with_handler when intercepting ActiveJob exc…
Browse files Browse the repository at this point in the history
…eptions (#1027)

When using ActiveJob's `rescue_from` (or `retry_on` / `discard_on` which are implemented with `rescue_from`), ActiveJob will return the captured exception. This PR fixes Sentry's ActiveJob instrumentation to preserve that behavior.
  • Loading branch information
bensheldon authored Sep 17, 2020
1 parent a5f101a commit 0ab5a47
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion lib/raven/integrations/rails/active_job.rb
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,8 @@ def self.included(base)
def capture_and_reraise_with_sentry(job, block)
block.call
rescue Exception => e # rubocop:disable Lint/RescueException
return if rescue_with_handler(e)
rescue_handler_result = rescue_with_handler(e)
return rescue_handler_result if rescue_handler_result

Raven.capture_exception(e, :extra => raven_context(job))
raise e
Expand Down

0 comments on commit 0ab5a47

Please sign in to comment.