That does put the decision more into personal opinion territory, yes.
If we’re there: the issue is about better programmatic access to the raised exception, so I’d prefer the consistent type.
Even more personal opinion: I would do try/raise e.__cause__/except*
rather than isinstance/split
.
1 Like
AFAIK if you use except*
for a non-group exception it still catches it. There’s still the argument that if it isn’t always an exception group, users will forget to use except*
and get in trouble when they receive a group.
But honestly I’ve never done anything with a cause or context other than reading the printed traceback to help me debug a situation. Not once have I felt the need to look at the cause/context of an exception that I’ve caught.
I trust Erlend’s judgment here though.
2 Likes