Gets diagnostic information about the last exception generated. Information about the last exception generated on the current thread is returned in a CCI_EXCEPTION_WIDE_ST output structure. The user-defined extension uses this function to determine whether any recovery is required when a utility function returns an error code.
You can call this function, when a utility function or user exit callback indicates that an exception has occurred, by setting returnCode to CCI_EXCEPTION.
Unless CCI_EXCEPTION is indicated you must not call cciGetLastExceptionDataW() because it returns unpredictable results.
void* cciGetLastExceptionDataW(
int* returnCode,
CCI_EXCEPTION_WIDE_ST* exception_st);
The value returned in the exception_st.messageNumber field, for exceptions resulting in a BIP cataloged exception message, contains the message level in the high order bytes and the BIP message number in the lower four bytes.
None. If an error occurs, the returnCode parameter indicates the reason for the error.
typedef struct exception_wide_st {
int versionId; /* Structure version identification */
int type; /* Type of exception */
int messageNumber; /* Message number */
int insertCount; /* Number of message inserts */
CCI_STRING_ST inserts[CCI_MAX_EXCEPTION_INSERTS];
/* Array of message insert areas */
const char* fileName; /* Source: file name */
int lineNumber; /* Source: line number in file */
const char* functionName; /* Source: function name */
CCI_STRING_ST traceText; /* Trace text associated with exception */
CCI_STRING_ST objectName; /* Object name */
CCI_STRING_ST objectType; /* Object type */
} CCI_EXCEPTION_WIDE_ST;
char msgnumTypeStr[64];
CCI_EXCEPTION_WIDE_ST exception_st = malloc(sizeof(CCI_EXCEPTION_WIDE_ST));
int rc = 0;
memset(&exception_st,0,sizeof(exception_st));
cciGetLastExceptionDataW(&rc, &exception_st);
sprintf(msgnumTypeStr, "MsgNum: %d Type: %d",
(exception_st.messageNumber & 0x0ffff),
(exception_st.type & 0x0f));