获取有关生成的最后一个异常的诊断信息。当前线程上生成的最后一个异常的信息在 CCI_EXCEPTION_WIDE_ST 输出结构中返回。用户定义的扩展使用此函数来确定当实用程序函数返回错误代码时是否需要任何恢复。
当某一实用程序函数或用户出口回调指出发生了异常时,您可以通过将 returnCode 设置为 CCI_EXCEPTION 来调用该函数。
exception_st.messageNumber 字段中返回的值对应于产生 BIP 编目异常消息的异常,其中包含高次字节的消息级别和四个低字节的 BIP 消息号。
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; 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);