throw
The EGL throw statement specifies an
exception that you want to trigger. Doing so has the following effects:
- Program processing ceases
- If the exception is thrown within a try block, control passes to the first appropriate onException block within that try block. For more details, see try.
- If the exception is not thrown within a try block, the program terminates with the message in the specified exception record.
Specify an exception expression (an expression that resolves to
the type of an exception variable; see The Exception stereotype) with the throw statement.
Here are two forms that such an expression can take:
// when the exception is already defined
nullEx NullValueException;
...
throw nullEx;
// define and declare
Record CustomerException type Exception
customerNumber INT;
end
...
throw new customerException {
customerNumber = custNum,
message = "Illegal customer number" };Exceptions propagate upward from the point of the error. A try statement can handle an exception that occurs within any functions called from the try block, no matter how deeply nested. For more information on the exception handling process, see Exception handling.
Syntax

- exceptionExpression
- An expression whose value has the same type as an exception variable.
Compatibility
| Platform | Issue |
|---|---|
| V6 exception compatibility mode | If the v60ExceptionCompatibility program property is set to YES, the throw statement is not valid. |