Nearly all Message Queue C functions return an MQStatus result. You can use this return value to determine whether the function returned successfully and, if not, to determine the cause of the error.
Table 2–12 lists the functions you use to get error information.
Table 2–12 Functions Used in Handling Errors
Function |
Description |
---|---|
Returns an MQ_TRUE if the specified MQStatus is an error. |
|
Returns the error code for the specified MQStatus. |
|
Returns a descriptive string for the specified MQStatus. |
|
Returns the calling thread’s current error trace or NULL if no error trace is available. |
Call MQStatusIsError, passing it an MQStatus result for the function whose result you want to test.
If the MQStatusIsError function returns MQ_TRUE , call MQGetStatusCode or MQGetStatusString to identify the error.
If the status code and string information is not sufficient to identify the cause of the error, you can get additional diagnostic information by calling MQGetErrorTrace to obtain the calling thread’s current error trace if this information is available.
Chapter 4, Reference, lists common errors returned for each function. In addition to these errors, the following error codes may be returned by any Message Queue C function:
MQ_STATUS_INVALID_HANDLE
MQ_OUT_OF_MEMORY
MQ_NULL_PTR_ARG
In addition, the MQ_TIMEOUT_EXPIRED can return from any Message Queue C function that communicates with the Message Queue broker if the connection MQ_ACK_TIMEOUT_PROPERTY is set to a non-zero value.