exception chaining

Linking a new exception to the one that caused it, so the higher-level failure still carries the original error and its stack trace.

In more detail

In Java you pass the caught exception to the new exception's constructor, and in Python you write raise NewError(...) from err. Logs and tracebacks then show both the high-level failure and the low-level reason. Dropping the cause throws away the evidence that explains the failure.

Examples

StorageFailure(Throwable cause) { super(cause); }
ex.getCause().getMessage()

Related terms

Taught in

References