Programming Guide |
Installs an error handler
void sm_obj_onerror(char *handler);
handler
- The name of the error handler. This C function or JPL procedure will be passed three parameters:
errorNumber
- The error number as an integer. Use this value to test for errors.
errorHexidecimal
- The error number as a string in hexadecimal format, as in
0x80000307
. (This parameter is displayed by the default error handler.)errorMessage
- The text description of the error. (This parameter is displayed by the default error handler.)
COM, EJB, Java
Client
sm_obj_onerror
specifies the error handler that will be called if an operation returns a negative exception.An error handler will only be fired on negative exception codes; for COM/MTS applications, use sm_com_result to retrieve positive exceptions.
If you do not want an error handler, you must install your own error handler that simple returns.
To restore the default error handler, use
sm_obj_onerror("")
.
// This JPL module specifies an error handler
// similar to the default error handler.
call sm_obj_onerror (handler)
proc handler (errnum, errhex, errmsg)
msg emsg "COM Error: " errhex " " errmsg
return