throwAsCaller
Class:MException
Throw exception as if occurs within calling function
Syntax
throwAsCaller(exception)
Description
throwAsCaller(
throws an exception as if it occurs within the calling function. The exception terminates the currently running function and returns control to the keyboard or an enclosing异常
)catch
block. When you throw an exception from outside atry/catch
statement, MATLAB®displays the error message in the Command Window.
You can access theMException
对象通过一个try/catch
statement or theMException.last
method.
In some cases, it is more informative for the error to point to the location in the calling function that results in the exception rather than pointing to the function that actually throws the exception. You can usethrowAsCaller
to simplify the error display.
Input Arguments
Examples
See Also
MException
|MException.addCause
|MException.getReport
|MException.last
|MException.rethrow
|MException.throwAsCaller
|assert
|error
|try, catch