try x then y else ztry x then y except err do zThe return value is the value returned by y or z, as the case may be.
|
The clause then y may be omitted, in which case the return value is the value returned by x if there is no error or alarm.
|
The clause else z may be omitted, in which case the return value is the value returned by y, unless an error or alarm occurs, in which case null is returned.
|
The clauses then y else z may both be omitted, in which case the return value is the value returned by x, unless an error or alarm occurs, in which case null is returned.
|
In the alternate form try x then y except err do z, x is first evaluated. If no error occurs, then the value of y is returned, or the value of x if the then y clause is omitted. If an error occurs, then the corresponding Error object is assigned to the symbol specified by err. That symbol is then available during the evaluation of z, whose value is returned.
|
|
|
The behavior of interrupts (other than alarms) is unaffected.
We will change the behavior of this function soon so that it will be possible to catch errors of a particular type. Meanwhile, users are recommended to use this function sparingly, if at all.