exceptiongroup
exceptiongroup copied to clipboard
This PR is a prototype implementation of #20. Notable additions and changes include: * ``ExceptionGroup`` is "Generic" and can be specialised by exceptions. This allows catching specific groups, e.g. ``except...
See https://github.com/python-trio/trio/issues/611#issuecomment-453269216 This is probably nicer than `with catch`? @1st1 *hates* `with catch` so maybe he'll like this better :-)
This is related to python-trio/trio#1683. Just a POC for how the API could look with `ExceptionGroup`.
As an alternative *or addition* to #5, it is possible to use Python's ``try``-``except`` natively: ```python3 try: async with something: something.raise_concurrent() except MultiError[A]: print("Handled concurrent A") except MultiError[A, B] as...
The old `MultiError` code didn't have to worry about this, because of unwrapping, but we do. If a program terminates with an `ExceptionGroup` that consists of only `SystemExit` exceptions, then...
Sometimes after people catch an exception, they need to access attributes on it (e.g., `OSError.errno`). But if you do `with catch(OSError, handler): ...`, then `handler` has to be prepared to...
@1st1 has strong feelings (I think) about monkeypatching being something that should be invoked explicitly instead of happening on import. I'm not sure of the concrete rationale in this particular...