-
-
Notifications
You must be signed in to change notification settings - Fork 365
Closed
Description
Currently, with a default of strict_exception_groups=false
, run_process
will currently almost always return singular exceptions, only giving multiple exceptions (afaik) if it encounters problems with reading from input/output streams.
with #2886 that will change, where any exception encountered when running the user-specified deliver_cancel
, plus stream errors, will be wrapped. @Zac-HD initially favored reraising groups as TrioInternalError
with the group as a cause - but after discussion with @richardsheridan I'm punting it to a separate issue & PR.
Possible solutions include:
- Be open about the fact that there's a nested nursery, and you will get an ExceptionGroup if there's a problem in it. [Status Quo in change strict_exception_groups default to True #2886]
- specify
strict_exception_groups=false
to the nested nursery a la Fix regressions introduced when hidingNursery.start
implementation-detail nursery #2845 - but that still leaves the theoretical possibility of getting exceptiongroups in weird cases (unless those are then caught and reraised as a different exceptions), and if we're to deprecate loose exception groups then it seems bad to use it here. - catch ExceptionGroups from the nursery, and reraise as
TrioInternalError
, unless they're allCancelled
so as not to mess with Cancellations. - Do special handling of exceptions in
deliver_cancel
, marking them and extracting them from the exceptiongroup to be raised. - If there's only a single exception in the group, extract and raise it.
- Wrap all other exceptions in exceptiongroups.
- ... likely much better solutions I'm not aware of
richardsheridan