Handling errors and status

This section provides the following information about how the methods of the C++ connector library indicate error conditions:

Note:
You can also use error logging and message logging to handle error conditions and messages in your connector. For more information, see Message logging

C++ return codes

In the C++ connector library, the outcome-status constants in the BusObjStatus.h file define the C++ return codes. Table 88 lists the C++ outcome-status constants.

Table 88. C++ return codes
Outcome-status constant Description
BON_SUCCESS
The operation succeeded.
BON_FAIL
The operation failed.
BON_APPRESPONSETIMEOUT
The application is not responding.
BON_BO_DOES_NOT_EXIST
The connector performed a Retrieve operation, but the entity that the business object represents does not exist in the application database.
BON_MULTIPLE_HITS
The connector found multiple matching records when retrieving using non-key values. The connector returns only the first matching record in a business object.
BON_FAIL_RETRIEVE_BY_CONTENT
The connector was not able to find matches for retrieve by non-key values.
BON_UNABLETOLOGIN
The connector is unable to log in to the application.
BON_VALCHANGE
At least one value in a business object has changed.
BON_VALDUPES
There are multiple records in the application database with the same key values.
BON_CONNECTOR_NOT_ACTIVE
The connector is not active; it has been paused.
BON_NO_SUBSCRIPTION_FOUND
No subscriptions exist for the event.

Outcome-status constants are provided for use in user implementations of many of the C++ virtual methods, as Table 89 shows. Although your code can return these values from within any method, some of the return codes were designed with specific uses in mind. For example, VALCHANGE informs an integration broker that the connector is sending a business object with changed values.

Table 89. Outcome-status values for C++ virtual methods
Virtual method Possible outcome-status codes
init() BON_SUCCESS, BON_FAIL, BON_UNABLETOLOGIN
doVerbFor() BON_SUCCESS, BON_FAIL, BON_APPRESPONSETIMEOUT, BON_VALCHANGE, BON_VALDUPES, BON_MULTIPLE_HITS, BON_FAIL_RETRIEVE_BY_CONTENT, BON_BO_DOES_NOT_EXIST
gotApplEvent() BON_SUCCESS , BON_FAIL, BON_CONNECTOR_NOT_ACTIVE, BON_NO_SUBSCRIPTION_FOUND
pollForEvents() BON_SUCCESS, BON_FAIL, BON_APPRESPONSETIMEOUT
terminate() BON_SUCCESS , BON_FAIL

The outcome-status constant that the connector framework receives helps to determine its next action, as follows:

Important:
The connector framework does not stop execution of the connector when it receives the BON_FAIL outcome-status constant.

Return-status descriptor

During request processing, the connector framework sends an empty structure, called a return-status descriptor, into the business object handler's doVerbFor() method. When doVerbFor() completes verb processing (either successfully or otherwise), the connector framework includes the return-status descriptor as part of its response to the integration broker.
WebSphere InterChange Server

If your business integration system uses InterChange Server, the collaboration can access the information in this return-status descriptor to obtain the status of its service call request. Therefore, the doVerbFor() can provide status information about verb processing to the collaboration by setting the message and status code within the return-status descriptor.

The connector framework automatically copies the outcome status that doVerbFor() returns into the status field of the return-status descriptor. Therefore, the doVerbFor() method can set a message in the return-status descriptor but it should not set the status, as this status will be overwritten when the connector framework copies the outcome status into this status field. For more information about the return-status descriptor and the doVerbFor() method, see "Populating the return-status descriptor".

Copyright IBM Corp. 1997, 2003