Using Exception Handlers in Non-JADE Applications
You can define and arm exception handlers in non-JADE applications (that is, in applications written in Smalltalk, Visual Basic, or C++ that interface to the JADE Object Manager Application Programming Interface).
Non-JADE applications should arm an exception handler by calling the JADE Object Manager API jomArmExceptionHandler entry point. For details about the parameters to this call, see "
As the default exception handler is not invoked if you intercept an exception with your own handler, the Unhandled Exception dialog is not displayed, regardless of the value returned for your exception handler.
If you want to invoke the default handler and therefore display the Unhandled Exception dialog and write the exception to the application log file, you must send the message "defaultHandler" to the exception object.
An exception handler in a non-JADE application can return any of the return values listed in the table under "Creating an Exception Handler", earlier in this chapter. The effects are similar, but are restated in the following table to clarify their effect in this context.
The following table lists the C++ defines that are provided in the jomdefs.h file.
Return Value | Define | Action |
---|---|---|
0 | E_CONTINUE | Processing continues as if no error had occurred. The JADE Object Manager Application Programming Interface (API) call that caused the exception ultimately returns a zero result to the user application. |
1 | E_ABORT_ACTION | Aborts the current action. The JADE Object Manager message stack is cut back, and control returns to the user application, with the JADE Object Manager API call that caused the exception returning a zero result. |
2 | E_RESUME_NEXT | If the exception handler was armed in an external method, the JADE Object Manager message stack is cut back to this method and the JADE Object Manager API call that caused the exception returns a zero result. If there were no JADE Object Manager messages on the stack when the handler was armed, the effect of the E_RESUME_NEXT define is identical to that of the E_ABORT_ACTION call. |
-1 | E_PASS_BACK | Passes control back to any previously armed exception handler for this type of exception. If there are no other applicable handlers, the JADE Object Manager message stack is cut back and control returns to the user application, with the JADE Object Manager API call that caused the exception returning a non-zero result representing the error condition. |