g2-error or g2-rpc-error, and G2 places a description of the error in the object's Error-description attribute.
signal statement signals an error, the error object is a transient or permanent instance of any instantiable error class, and the user code optionally places a description of the error in the object's Error-description attribute.
error is the parent all error classes, a block error handler that specifies the class error matches any error. A handler that specifies a more specific subclass matches only errors of that class and its subclasses.If G2 encounters a block error handler whose class matches the class of the error object, G2 executes the statement(s) in the body of the error handler. These statements can reference the error object in any standard way.
If G2 never finds a matching block error handler, it executes the default error handler. The system-defined default error handler is an
on error statement that:
error, and thus matches any error.
Error-description attribute, to the Operator Logbook.
When error handling either executes or occurs during execution of an RPC call, the remote process runs asynchronously from the error handler, and can change the context of the code that invoked the handler. When the handler returns, code that validates context may have to be rerun before code that assumes that context can safely continue execution.
sigproc:
![]() |
If you invoke
demonstrate-default-error-handler, the procedure:
sigproc.
g2-error and sets its Error-description attribute to describe the error.
g2-error.
![]() |
demonstrate-default-error-handler contains no further statements, the procedure returns.
sigproc. It is the same as the preceding example, except that it defines a block error handler on the calling procedure's begin-end block:
![]() |
If you invoke
demonstrate-block-error-handler, the procedure:
sigproc.
g2-error and sets its Error-description attribute to describe the error.
g2-error.
begin-end block.
![]() |
demonstrate-block-error-handler contains no further statements, so the procedure returns.Note that the value of
Error-description in the Message Board is message the same as in the Operator Logbook message in the previous example. It is the same because the error object generated by G2 is the same in both cases. The only difference is the handler that posts the information: the system-defined default error handler in the previous example, and a block error handler in this one.