A exceção cciThrowExceptionW é emitida pela interface do intermediário e utiliza os argumentos especificados como dados da exceção.
void cciThrowExceptionW(
int* returnCode,
CCI_EXCEPTION_TYPE type,
const char* file,
int line,
const char* function,
const CciChar* messageSource,
int messageNumber,
const CciChar* traceText,
...
);
O último argumento nesta lista deve ser (Ccichar*)0.
Nenhum. Se ocorrer um erro, o parâmetro returnCode indica o motivo do erro.
void raiseExceptionWithBroker(CciChar* helpfulText,
char* file, /* cujo arquivo de origem está interrompido */
int line, /* linha no arquivo acima */
char* func /* função no arquivo acima */
){
int rc = CCI_SUCCESS;
/* Configurar o nome do catálogo de mensagens */
const char* catalog = "BIPmsgs";
/* Converter o nome do catálogo para caracteres amplos.
* BIP_DEF_COMP_CCSID é UTF-8 em distribuído e LATIN1 no z/OS
*/
int maxChars = strlen(catalog)+1;
CciChar* wCatalog =(CciChar*)malloc(maxChars*sizeof(CciChar));
cciMbsToUcs(&rc, catalog, wCatalog, maxChars, BIP_DEF_COMP_CCSID);
/* O item acima pode ter falhado, mas já está sendo emitida uma exceção,
* assim, rc é agora configurado como tipo de sucesso. */
rc = CCI_SUCCESS;
/* Emitir a exceção. A explicação será incluída como o traceText e
* como uma inserção na mensagem
*/
cciThrowExceptionW(&rc,
CCI_USER_EXCEPTION,
file, line, func,
wCatalog, BIP2111,
helpfulText,
helpfulText,
(CciChar*)0
);
/* O item acima pode ter falhado, mas já está sendo emitida uma exceção,
* assim, o valor de rc não é importante. */
}