64,282
社区成员
发帖
与我相关
我的任务
分享
/*
** Client-Library error handler. This function will be invoked
** when a Client-Library has detected an error. Before Client-
** Library routines return CS_FAIL, this handler will be called
** with additional error information.
*/
CS_RETCODE CS_PUBLIC
clientmsg_callback(context, conn, emsgp)
CS_CONTEXT *context;
CS_CONNECTION *conn;
CS_CLIENTMSG *emsgp;
{
/*
** Error number: Print the error's severity, number, origin, and
** layer. These four numbers uniquely identify the error.
*/
fprintf(ERR_CH,
"Client Library error:\n\t");
fprintf(ERR_CH,
"severity(%ld) number(%ld) origin(%ld) layer(%ld)\n",
(long)CS_SEVERITY(emsgp->severity),
(long)CS_NUMBER(emsgp->msgnumber),
(long)CS_ORIGIN(emsgp->msgnumber),
(long)CS_LAYER(emsgp->msgnumber));
/*
** Error text: Print the error text.
*/
fprintf(ERR_CH, "\t%s\n", emsgp->msgstring);
/*
** Operating system error information: Some errors, such as
** network errors, may have an operating system error associated
** with them. If there was an operating system error, this code
** prints the error message text.
*/
if (emsgp->osstringlen > 0)
{
fprintf(ERR_CH,
"Operating system error number(%ld):\n",
(long)emsgp->osnumber);
fprintf(ERR_CH, "\t%s\n", emsgp->osstring);
}
/*
** If we return CS_FAIL, Client-Library marks the connection as
** dead. This means that it cannot be used anymore. If we return
** CS_SUCCEED, the connection remains alive if it was not already
** dead.
*/
return (CS_SUCCEED);
}