Exception handling

EPI exceptions can occur when a user application interacts with a terminal.

The exception hierarchy is shown in the following diagram:
Figure 1. Exception hierarchyThis Diagram shows a simple hierarchy. There are only 2 levels. At the top is EPIException with the following children: 'EPI327Exception', 'EPIRequestException', 'EPISecurityException', 'TerminalException', 'EPIGatewayException', 'EPITxnFailedException', 'EPIFieldException', 'EPIScreenException' and 'EPIMapException'.

A description of each of these exceptions is given in the Javadoc supplied with the product.

The other type of exception that can occur is IOException.

Use the getErrorCode method to retrieve the exception-specific error code which identifies the exceptions.

If you are using either a null session or a synchronous session, and you have not enabled ATIs and are not using Read Timeouts, all exceptions are thrown on the application thread. When trying to start methods such as connect, send, or disconnect, wrap the call in a try/catch/finally block.

When using asynchronous sessions, a problem arises if you have ATIs, or Read Timeouts, or both, enabled. In this case, exceptions can occur while within connect, send, and disconnect method invocations but also outside these calls.

If you use asynchronous sessions, exceptions cannot be thrown on any of the application threads. If you enable ATIs, or Read Timeouts, or both, it is recommended that you use asynchronous sessions.

To know when an exception has occurred when you are not invoking a terminal method, you can implement the handleException method on the session. See Synchronization and sessions, for an example of this. You can implement it for both synchronous and asynchronous sessions. If the terminal is unable to throw the exception on the application thread (that is, it is not blocked on a synchronous call or it is an asynchronous session), this method is invoked on a separate thread and the exception is passed to it.


Information Information

Feedback


Timestamp icon Last updated: Tuesday, 19 November 2013


https://ut-ilnx-r4.hursley.ibm.com/tg_latest/help/topic/com.ibm.cics.tg.doc//progde/exchand.html