Return codes from API calls are error conditions that can be handled at run time. The way in which you deal with this type of error depends on whether you are using the C or C++ API.
If an application calls a C API function and the call fails, a response with a return code other than XMS_OK is returned with an XMS error block containing more information about the reason for the failure. For further details, see Return codes and ErrorBlock.
The C++ API throws an exception when a method is used.
An application uses an exception listener to be notified asynchronously of a problem with a connection. The exception listener is supplied to, and is initialized using, the XMS C or C++ API. For further information, see Message and exception listener functions in C and Message and exception listeners in C++.
Some error conditions are an indication that some resource is unavailable, and the action that an application can take depends on the XMS function that the application is calling. For example, if a connection fails to connect to the server, then the application may wish to retry periodically until a connection is made. An XMS error block or exception might not contain enough information to determine what action to take, and, in these situations, there is often a linked error block or exception that contains more specific diagnostic information.
In the C API, always test for a response with a return code other than XMS_OK, and always pass an error block on the API call. The action taken usually depends on which API function is the application using. For further details, see Error handling in C.
In the C++ API, always include calls to methods in a try block and, to catch all types of XMS exception, specify the Exception class in the catch construct. For further details, see Error handling in C++.
The exception listener is an asynchronous error condition path that can be started at any time. When the exception listener function is started, on its own thread, it is usually an indication of a more severe failure than a normal XMS API error condition. Any appropriate action may be taken, but you must be careful to follow the rules for the XMS threading model as described in The threading model.