Site Menu Project Specification Implementation Recommendations Reference Needs Updating Work in Progress Wastebasket Wiki Manual |
Local Exception HandlingPROCEDURE Foobar( p1, p2, p3 : T ) : Status; BEGIN IF foo = NIL THEN BAILOUT(FooNilError); (* raise local exception *) ELSE doFooStuff; END; DoBar(bar); IF bar = 0 THEN BAILOUT(BarZeroError); (* raise local exception *) ELSE doBarStuff; END; DoBaz(baz); IF baz > MAXBAZ THEN BAILOUT(BazOverflowError); (* raise local exception *) ELSE doBazStuff; END; RETURN Success; (* handle local exceptions *) ON BAILOUT BazOverflowError : UndoBarStuff; BarZeroError : UndoFooStuff; FooNilError : RETURN Failure; END Foobar; Restrictions:
Pros:
Cons:
|