Skip to content

Only wrap subscriber exceptions if there is more than one#43581

Merged
byroot merged 1 commit intorails:mainfrom
Shopify:as-notification-raise-single
Nov 2, 2021
Merged

Only wrap subscriber exceptions if there is more than one#43581
byroot merged 1 commit intorails:mainfrom
Shopify:as-notification-raise-single

Conversation

@casperisfine
Copy link
Copy Markdown
Contributor

Ref: #43282
Ref: #43561

It can be legitimate for subscriber to want to bubble up some exception to the caller, so wrapping it change the exception class which might break the calling code expecting a specific error.

We can minimize this by only using InstrumentationSubscriberError when more than one subscriber raised.

Copy link
Copy Markdown
Member

@jhawthorn jhawthorn left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks great

Ref: rails#43282
Ref: rails#43561

It can be legitimate for subscriber to want to bubble up some exception
to the caller, so wrapping it change the exception class which might break
the calling code expecting a specific error.

We can minimize this by only using InstrumentationSubscriberError
when more than one subscriber raised.
@casperisfine casperisfine force-pushed the as-notification-raise-single branch from cdedc1a to acd462f Compare November 2, 2021 15:47
@byroot byroot merged commit 1d55f54 into rails:main Nov 2, 2021
@rafaelfranca rafaelfranca deleted the as-notification-raise-single branch November 2, 2021 18:49
@rafaelfranca rafaelfranca restored the as-notification-raise-single branch November 2, 2021 18:49
@rafaelfranca rafaelfranca deleted the as-notification-raise-single branch November 2, 2021 18:49
@rafaelfranca rafaelfranca restored the as-notification-raise-single branch November 2, 2021 18:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants