The cciThrowExceptionW exception is thrown by the broker interface and uses the specified arguments as exception data.
void cciThrowExceptionW(
int* returnCode,
CCI_EXCEPTION_TYPE type,
const char* file,
int line,
const char* function,
const CciChar* messageSource,
int messageNumber,
const CciChar* traceText,
...
);
The last argument in this list must be (Ccichar*)0.
None. If an error occurs, the returnCode parameter indicates the reason for the error.
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 = "BIPmsgs";
/* 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_USER_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. */
}