Previous Next Contents

4   Exceptions and error handling

4.1   Exceptions

There are two syntactic constructs dealing with exceptions: Note that service calls and language constructs may raise exceptions which can be caught with try...handle blocks. Language level exception provided are:

4.2   Error handling

Any exception raised by a PLAN program can be caught by a top level try...handle block. However, in the case that an exception arises outside of packet execution (such as if the packet runs out of resource bound before it can be evaluated), or if no enclosing try...handle block is defined, the packet handler is used for recovery. This is the name of a function, stored as part of the packet, which should be invoked back on the source. This function must have the following signature:
string × host × a chunk ® unit
The arguments are, respectively, the error which occurred, the node on which it occurred, and the (truncated) chunk which was (or would be, on arrival to the evalDest) evaluating when the error occurred. These arguments have the following properties: A default handler, defHandler is provided. There also exists a PLAN service, abort, which produces behavior similar to that of an invoked handler. Both are described in detail in Section 7.


Previous Next Contents