File size: 242 Bytes
60f5111 | 1 2 3 4 5 6 7 8 9 10 11 | @contextlib.contextmanager
def add_exc_note(note: str):
try:
yield
except Exception as err:
err.add_note(note)
raise
with add_exc_note(f"While attempting to frobnicate {item=}"):
frobnicate_or_raise(item)
|