Allow jobs to rescue all exceptions #41214
Merged
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.
Before this commit, only
StandardError
exceptions can be handled byrescue_from
handlers.This changes the rescue clause to catch all
Exception
objects, allowing rescue handlers to be defined forException
classes not inheriting fromStandardError
.This means that rescue handlers that are rescuing
Exception
s outside ofStandardError
exceptions may rescue exceptions that were not being rescued before this change.Other Information
When this was introduced in ef4aff0, ActionController was already rescuing all Exception objects, so maybe this was intentional, but there's no specific test about it.
There is some incompatibility in the sense that if an app is using
rescue_from(Exception)
, previously it would not have caught some exceptions, and now it will. But it was probably the expected behavior they wanted. We're not sure how we would go about making it fully backwards compatible anyway.cc @rafaelfranca @byroot