-
Notifications
You must be signed in to change notification settings - Fork 20
Open
Labels
enhancementNew feature or requestNew feature or request
Description
Just curious, I find myself using:
if sys.version_info < (3, 11):
err.__notes__ = getattr(err, "__notes__", []) + [msg] # type: ignore[attr-defined]
else:
err.add_note(msg) # pylint: disable=no-memberin order to add notes to the exceptions contained in the exception group. (See cattrs, where I got the idea from). There's already a helper function (exceptiongroup.catch()), would an add_note() helper be helpful and in scope?
This would be the definition, I think:
def add_note(err: BaseException, msg: str) -> None:
if sys.version_info < (3, 11):
err.__notes__ = getattr(err, "__notes__", []) + [msg]
else:
err.add_note(msg)ivirshup, moi90 and AbdealiLoKo
Metadata
Metadata
Assignees
Labels
enhancementNew feature or requestNew feature or request