When you have defined an exception handler, you must then arm it. The following syntax is used to arm an exception handler.
on exception-class do method-call-expression [global];
The exception-class identifier is the
Each process can have up to 128 global exception handlers armed at any one time. There is no JADE‑imposed restriction on the number of non-global exception handlers that can be armed at any time by any one process.
When you arm an exception handler, note the following points.
The method-call-expression identifier can be in the following form.
object-reference-expression.method-identifier
In this case, method-identifier is invoked for the specified object if an exception occurs.
The method-call-expression identifier can be in the form method-identifier, in which case method-identifier is invoked for the object upon which the method arming the exception handler is invoked.
The method used to arm an exception handler can have parameters in addition to the exception parameter that refers to the exception object created and passed when the exception was raised. For example, you could specify an optional parameter that refers to the current object and an optional parameter that refers to an integer variable; for example:
on Exception do exceptionHandler(exception, currentObj, n);
The exception object must be the first parameter that you specify when arming an exception handler.
As the receiver of an exception must be an object, you cannot arm the exception handler when the receiver is a primitive type.
The contents of the parameter expressions passed to the exception handler method are evaluated as follows.
At the moment the exception handler is armed, for global exception handlers
At the moment that the exception occurs, for local exception handlers