Raise group of exceptions if many signal handlers fail
- Dominant language
- No language data
- Stars
- 188
- Forks
- 7
- PR merge metrics
- No merged PRs in 30d
Description
### Code of Conduct
- [x] I agree to follow Django's Code of Conduct
### Feature Description
Introduced in 3.11, [ExceptionGroup](https://docs.python.org/3/library/exceptions.html#lib-exception-groups) can be used to capture multiple exceptions, rather than just the first.
There should be an API which groups exceptions together and raises them at once at the end.
### Problem
When a signal has multiple receivers, `.send` will skip running future handlers if one fails. This may be undesirable in some cases, especially for custom signals.
### Request or proposal
request
### Additional Details
This is different to `send_robust`, as `send_robust` quietly ignores errors, whereas this API would allow the sender to handle any errors if necessary (or continue the same behaviour whilst allowing all handlers to run but still report an error afterwards)
### Implementation Suggestions
An additional API on `Signal` to `send_and_group` (name TBC) which runs all registered receivers, collects any exceptions and re-raises an `ExceptionGroup` with them.
Because the `ExceptionGroup` is a different exception to the inner exception, this can't be handled with the existing `.send` (I think?).
If no exception handling is done, it may be safe to update some internal implementations from `.send` to this.
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.