6.1. Declaring and throwing
throws T in a procedure's signature says the procedure may finish by throwing a
T. In the body, throw e raises e and abandons the rest of the procedure.
composite Exception {}
composite ArithmeticException extends Exception {}
procedure div(a: int, b: int) returns (r: int)
throws (e: Exception)
opaque
{
if b == 0 then {
var ae: ArithmeticException := new ArithmeticException;
throw ae
};
r := a / b
};
throws is part of the signature — it changes what callers have to deal with — so
it sits with returns, before opaque.