Overview

In a complex system, you would generally write different parts of a JADE application independently. The JADE application can be based around an existing framework or it can make use of existing services in a library or class hierarchy.

Errors are represented and handled in JADE by using exception objects (instances of the Exception class or its subclasses).

JADE assumes that errors or exceptions in a stable production system will occur infrequently (if at all), but they cannot be ignored completely. Error handling code is therefore separated from the mainstream application code, providing cleaner application code that is not cluttered with error handling code.

JADE exception handling applies to both JADE methods and external methods, and provides a mechanism that enables you to construct JADE applications that are tolerant of exceptions that occur because of abnormal conditions.

At run time, the subsystem providing a service can detect an error but will generally not know what to do about the error. Alternatively, the subsystem using the service may be able to deal with the error but may not be able to detect it.

The Exception class and its subclasses are used to deal with system exceptions and raising user exceptions in both JADE methods and external methods. Other error conditions (for example, errors in user input) fall into the category of normal application code that implements a business rule.

In JADE thin client mode, exception dialogs are always displayed on the presentation client.

For details about finding the position in a method source if you want to locate the position at which an exception occurred in a deployed application from which source code has been removed, see "Finding a Method Source Position", in Chapter 4 of the JADE Development Environment User’s Guide.

Call the Object class getClassForObject method if you want to return a reference to the class of a specified object identifier (oid) even if this object is no longer valid; for example, in exception handlers that may need to deal with object references that are no longer valid.

For a discussion about exception handling, see the Erewhon.pdf file that is included in the erewhon subdirectory of the examples directory on the JADE release medium.

Exception states on client nodes and server nodes are independent. If an exception occurs while executing on the client node, exception state on the server node is not set. Similarly, if an exception occurs while executing a server execution method, exception state on the client node is not set.

For details about using generic exit values that apply to JADE programs and utilities when running JADE, see Appendix C, in Appendix A of the JADE Installation and Configuration Guide. These exit values enable you to develop tools that can take appropriate actions based on the exit values of supplied programs. In addition, a range of exit values is set aside for warnings, enabling a program to return information without it being regarded as a fatal problem.