Apama 10.15.0 | Developing Apama Applications | EPL Reference | Statements | Simple statements | The throw statement
 
The throw statement
The throw statement causes an exception to be thrown. If it is not caught by a try ... catch in that action or any calling actions, then the monitor instance is terminated along with any listeners it has. The syntax is:
throw expression;
where expression must be of the Exception type.
Example:
action getAverageReading() returns float {
if readingsCount <= 0 {
throw Exception("No readings", "IllegalArgumentException");
}
return readingsSum / readingsCount.toFloat();
}
See also Exception handling.