-
Notifications
You must be signed in to change notification settings - Fork 514
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add support for ExceptionGroups #2025
Conversation
@antonpirker pls rebase/merge master |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
couple of questions to start, I need to read the PEP to review this properly, will get back to it.
…entry-python into antonpirker/exception_groups
This can be shipped as soon as getsentry/sentry#48653 is completed and released to production. Also, for the best experience with exception groups, self-hosted Sentry users should take the corresponding update when it is available. |
@andyljones - That's because you're only raising one error, and the default behavior for trio is to only raise an exception group if there's more than one error in the group. To raise an exception group from Trio, you can do either of the following:
See "Strict" versus "loose" ExceptionGroup semantics in the Trio docs. The section right before that is also a great introduction to exception groups in Trio. |
Also, just to point out some of the extra work that went into this on the Sentry side, note that an error such as the one shown above will be titled and grouped by the first inner exception: That's because all exceptions within the group are of the same type and have similar values. Without this, the error would be titled by the root exception, "NonBaseMultiError: multiple tasks failed" - which could make it difficult to distinguish between issues on the issues overview. Also different quantities of inner exceptions of the same type and similar values will be grouped together, rather than separately. (i.e. having Conversely, when the inner exceptions differ significantly - then we'll use the exception group as the title, and group issues based on the combination of the types and values of the inner exceptions. For example: Will get titled as: If another of the same exception comes through but the |
With Python 3.11 ExceptionGroups was introduced. This adds support for catching them and displaying them in a meaningful way.
See also the related RFC: https://github.com/getsentry/rfcs/blob/main/text/0079-exception-groups.md
Fixes #1788