Avoid rescuing from errors in Active Record transaction callbacks in versions of Rails where they will be re-raised #717
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Goal
Rails used to swallow errors in transaction callbacks like
after_commit
. In Rails 4.2, theraise_in_transactional_callbacks
option was added, which make Rails re-raise errors in these callbacks. The option was removed in Rails 5 and from then on Rails will always re-raise errors in transaction callbacksWe have an Active Record integration that rescues errors in transaction callbacks and sends them to Bugsnag. This is unnecessary on Rails 5+ & 4.2 with
raise_in_transactional_callbacks
enabled and can cause errors to be reported twice on these versionsThis PR is #709 with the config option renamed to
raise_in_transactional_callbacks
as that's what was eventually released in Rails 4.2 (it went through several refactors/renames across a few PRs). I've also added tests that raise errors in anafter_commit
callback, so we have coverage of:raise_in_transactional_callbacks
enabledraise_in_transactional_callbacks
disabled