rethrow
Rethrow previously caught exception
Syntax
Description
rethrow(
rethrows a previously
caught exception, exception
)exception
. MATLAB® typically responds to errors by terminating the currently running
program. However, you can use a try/catch
block to catch the
exception. This interrupts the program termination so you can execute your own error
handling procedures. To terminate the program and redisplay the exception, end the
catch
block with a rethrow
statement.
rethrow
handles the stack trace differently from error
, assert
, and throw
. Instead of creating the stack from where MATLAB executes the function, rethrow
preserves the
original exception information and enables you to retrace the source of the original
error.
Examples
Input Arguments
Version History
Introduced in R2007b
See Also
assert
| try, catch
| error
| MException.last
| throw
| throwAsCaller