addCause
Attach a cause exception to a base exception.
Syntax
Section titled “Syntax”newME = addCause(baseME, causeME)Description
Section titled “Description”Returns a copy of baseME with causeME added to its causes list. Useful for chaining exceptions: re-throw a high-level error while preserving the underlying cause for diagnostic purposes.
Examples
Section titled “Examples”try; foo; catch ME1; ME2 = MException('MyApp:summary', 'foo failed'); ME2 = addCause(ME2, ME1); throw(ME2);endSee also
Section titled “See also”MException— Construct an exception object.throw— Throw a previously-constructed exception.getReport— Format an exception object as a string.