Question: suppose we wanted to let users mostly deal with individual exception objects instead of ExceptionGroups, and we want to do that without losing the rich traceback metadata. (Tree structure, notes about places where exceptions crossed between tasks, ...) What would that look like?
The big challenge is that in current trio.MultiError
, if you want to extract an individual exception and make it a proper standalone object, you have to mutate its __traceback__
attribute to capture the info that's otherwise only present in the MultiError
object. (And this in turn is the main reason I've argued for except ValueError as exc
being run once with a single ExceptionGroup
: if we iterate, then we have to extract individual exceptions. If we wrap in a new ExceptionGroup
, then we never have to mutate any exception objects in place.) So if we can solve this mutation problem, then it unlocks a lot of new possibilities.
Requirements would be:
- Given an individual exception
exc
, you can print its trac