Experiment with ExceptionGroup
and BaseException.add_note()
(in Python 3.11)
#3175
Labels
interop
how to play nicely with other packages
legibility
make errors helpful and Hypothesis grokable
PEP 654 introduces a new
ExceptionGroup
type, which is designed to replace Trio'sMultiError
and our very ownMultipleFailures
types. There's also neat newexcept*
syntax for handling them, but that's not our problem. Based on our conversation, Irit Katriel also addedBaseException.__note__
so that we can attach ourFailing example:
strings (etc) to the exception objects, instead of printing them by hand.So before Python 3.11 is released, preferably in the alphas (i.e. before May 2022), we should get this working - preferably shipped; but at least prototyped to a level that any problems can be fixed and re-tested before 3.11rc1.
Presumably at some point there will be a
backports.exceptiongroup
package that we can standardize on along with Trio, Pytest, and so on; but until then I'm happy to keep using our own exceptions.The text was updated successfully, but these errors were encountered: