Commit 7b48d11a authored by Christopher Suter's avatar Christopher Suter Committed by TensorFlower Gardener
Browse files

Preserve stack trace when conditionally re-raising.

The error handling code in question looks to see if a raised exception is of type TypeError, and if so, if its message matches a pattern, in which case it raises a more informative message about dynamic control flow. However, If it doesn't match the message, it seeks just to reraise the underlying exception. When doing this with "raise e", the underlying stack trace is lost; instead, we should just use "raise", which keeps the source stack trace.

Source for the re-raise behavior: https://stackoverflow.com/questions/8146386/python-conditionally-catching-exceptions

PiperOrigin-RevId: 231500445
parent c46d3831
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please to comment