try:
something()
except Exception as e:
e.add_note("some helpful context")
This code is easy to write, but it has a nasty problem: you've just suppressed the exception! I think there should be a lint warning which triggers if you .add_note() an exception which is not either followed by a raise or raise e, or included in a function call or rhs of an assignment expression.
This code is easy to write, but it has a nasty problem: you've just suppressed the exception! I think there should be a lint warning which triggers if you
.add_note()
an exception which is not either followed by araise
orraise e
, or included in a function call or rhs of an assignment expression.