Installs a developer-supplied error handler for Open Data Services errors.
SRV_ERRHANDLE_PROC srv_errhandle ( SRV_ERRHANDLE_PROC handler );
where
A pointer to the previously installed error-handling function.
When an error occurs, Open Data Services automatically calls the error handler installed by srv_errhandle. The error handler determines the Open Data Services server application's response to errors. For example, it can tell the Open Data Services server application whether to continue, to return an error, or to terminate the connection.
If no error handler is installed, then a default error handler is used. The default error handler writes messages to the standard error output and to the Open Data Services log file.
If the severity of the error is 1 through 9, then an informational message is assumed and the default error handler returns SRV_CONTINUE (continue processing). If the severity of the error is 10 through 18, then an error condition is assumed and the default error handler returns SRV_CANCEL (and returns FAIL to the invoking function). If the severity of the error is 19 or higher, then some form of fatal error is assumed, and the default error handler returns SRV_EXIT, which terminates the thread associated with this client connection. (Error numbers and severities are defined in the Open Data Services header file SRVCONST.H.)
A developer-supplied error handler is invoked with the following parameters defined. These parameters are provided by the ODS Library whenever it detects an internal error:
Parameter | Meaning |
---|---|
server | The affected Open Data Services server application process. |
srvproc | The affected client process. |
srverror | The Open Data Services error number. |
severity | The severity of the error: informational (SRV_INFO), fatal for the client process (SRV_FATAL_PROCESS), or fatal for the Open Data Services server application (SRV_FATAL_SERVER). |
state | The state of the error. |
oserr | The operating-system error number. |
errtext | A printable description of the Open Data Services error. |
errtextlen | The length of the Open Data Services error string errtext. |
oserrtext | A printable description of the operating-system error string oserr. |
oserrtextlen | The length of the operating-system error string oserr. |
One of the following values should be returned by a developer-supplied error handler:
Return value | Meaning |
---|---|
SRV_CONTINUE | Pass a non-fatal error or an information message from the Open Data Services server application to the client and continue processing. |
SRV_CANCEL | Return SRV_FAIL from the Open Data Services function that caused the error. |
SRV_EXIT | Print an error message and terminate the client connection thread. |
A developer-defined error handler can be installed at any time. The new handler automatically replaces an existing handler. To remove an existing error handler and install the default error handler, use srv_errhandle with a null parameter.
This entry | For information about |
---|---|
srv_convert | Converting datatypes |
srv_sendmsg | Sending Open Data Services errors to the client |