cciThrowExceptionW

抛出异常。异常由使用指定的自变量作为异常数据的消息代理抛出。

语法

void cciThrowExceptionW(
  int*                returnCode,
  CCI_EXCEPTION_TYPE  type,
const char*         file,
  int                 line,
const char*         function,
const CciChar*    messageSource,
  int                 messageNumber,
const CciChar*      traceText,
...
);

参数

returnCode
来自函数(输出)的返回码。如果参数 messageSource 为 null,则 returnCode 将被设置为 CCI_INV_DATA_POINTER。
type
异常的类型(输入)。有效值是:
  • CCI_FATAL_EXCEPTION
  • CCI_RECOVERABLE_EXCEPTION
  • CCI_CONFIGURATION_EXCEPTION
  • CCI_PARSER_EXCEPTION
  • CCI_CONVERSION_EXCEPTION
  • CCI_DATABASE_EXCEPTION
  • CCI_USER_EXCEPTION
file
生成异常(输入)的源文件名。值是可选的,但对于调试目的非常有用。
line
生成异常的源文件中的行号(输入)。值是可选的,但对于调试目的非常有用。
function
生成异常的函数名(输入)。值是可选的,但对于调试目的非常有用。
messageSource
它是用于识别 Windows 消息源或 LinuxUNIX 消息目录的字符串。要使用当前的 WebSphere Message Broker 版本的消息目录,请在所有操作系统上都使用 BIPV600
messageNumber
标识异常的消息数(输入)。如果 messageNumber 指定为零,则假设消息不可用。如果 messageNumber 为非零,则指定的消息写到代理事件 日志中,附带在变量参数列表中提供的任何插入内容。
traceText
写到代理跟踪日志中的跟踪信息(输入)。信息是可选的,但对于调试目的非常有用。
...
包含与消息在一起的任何消息插入内容的 C 变量参数列表(输入)。这些插入内容作为字符串处理,并且变量参数假设为类型指针到 CciChar
注: 此列表中的最后一个自变量必须(Ccichar*)0

返回值

无。 如果发生错误,则 returnCode 参数表明错误原因。

示例

void raiseExceptionWithBroker(CciChar* helpfulText, 
char* file, /* which source file is broken */
int line,   /* line in above file */
char* func  /* function in above file */
){
  int          rc = CCI_SUCCESS;
/* Set up the message catalog name */
const char* catalog = "BIPv600";
/* Convert the catalog name to wide characters. 
* BIP_DEF_COMP_CCSID is UTF-8 on distributed and LATIN1 on z/OS 
*/
int maxChars =  strlen(catalog)+1;
CciChar* wCatalog =(CciChar*)malloc(maxChars*sizeof(CciChar));
cciMbsToUcs(&rc, catalog, wCatalog, maxChars, BIP_DEF_COMP_CCSID);
/* The above might have failed, but we are already throwing an exception,
* so rc is now set to type success. */
rc = CCI_SUCCESS;
/* Throw the exception. The explanation will be added as the traceText and
*  as an insert to the message 
*/
cciThrowExceptionW(&rc,
CCI_FATAL_EXCEPTION,
file, line, func,
wCatalog, BIP2111,  
helpfulText,  
helpfulText,  
(CciChar*)0 
);
/* The above might have failed, but we are already throwing an exception,
* so the value of rc is not important. */
}
相关概念
用户定义的扩展
声明 | 商标 | 下载 | | 支持 | 反馈
Copyright IBM Corporation 1999, 2006 最后更新:2006/05/19
as24560_