Bridges > Java Export Bridge > Java Error Handling

# Java Error Handling

When an error occurs in a Java wrapper object, it throws an unchecked exception of type JIDLException (or a subclass of JIDLException), which means that calls into a wrapper object should be wrapped in try-catch blocks, as is standard in Java. JIDLException provides the following method for getting the IDL error code:

public long getErrorCode();

In addition, because JIDLException inherits from java.lang.Error, other Java exception methods such as getMessage and printStackTrace are available.

The table below describes the error return values and their meaning when they are returned within the context of the wrapper method calls. The Java errors are encapsulated in a JIDLException object or a subclass of JIDLException, as noted in the table.

Error Exception/Code | Meaning
--- | ---
JIDLBusyException (a subclass of JIDLException) with JIDLConst.IDL_BUSY error code | IDL is busy. The client made a method call on a wrapper object, but the underlying IDL process is still busy with a previous request (method call) and has not finished yet. For more information, see IDL Ownership and Blocking.
JIDLException with JIDLConst.IDL_ABORT_NOT_OWNER error code | The client called the abort method on a wrapper object, but that wrapper object is not the current owner of the underlying IDL process. Therefore, it is not allowed to abort IDL.
JIDLException with JIDLConst.IDL_NOTHING_TO_ABORT error code | The client called the abort method on a wrapper object, but the underlying IDL process is not currently busy, so there is nothing to abort.
JIDLAbortedException (a subclass of JIDLException) with JIDLConst.IDL_ABORTED error code | This error is returned from the original wrapper method call whose operation was aborted by a successful call to the abort method.
JIDLException with JIDLConst.OPS_NOTICE_PROCESS_ABORTED error code | This error occurs when the client has created several wrapper instances whose underlying IDL objects all live in the same IDL process. During a method call on one of those wrapper instances, the IDL pro code issues the IDL exit command. When this occurs, the process is destroyed, which also destroys all the underlying IDL objects. However, the client needs to be notified of this event so that it can consider all those wrapper instances as invalid and not use them again. First, each listener (event subscriber) for each wrapper instance receives an OnIDLNotify callback with the first string set to “OPS_NOTIFY_EXIT”. Then, the method call (if any) that is in progress at the time of the EXIT command will return with the specified error code. Upon receiving the notification and after receiving this error code, the user must not make any other method calls on the wrapper instance, as the underlying IDL object no longer exits.
JIDLException with IDL error code | A specific IDL error occurred. The error code is the same as the IDL error code.