throw

The EGL throw statement specifies an exception that you want to trigger. Doing so has the following effects:
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

Syntax diagram for the throw statement
exceptionExpression
An expression whose value has the same type as an exception variable.

Compatibility

Table 1. Compatibility considerations for throw
Platform Issue
V6 exception compatibility mode If the v60ExceptionCompatibility program property is set to YES, the throw statement is not valid.

Feedback