How to re-raise an exception in nested try/except blocks?
As of Python 3, the traceback is stored in the exception, so a simple raise e will do the (mostly) right thing: try: something() except SomeError as e: try: plan_B() except AlsoFailsError: raise e # or raise e from None – see below The traceback produced will include an additional notice that SomeError occurred while … Read more