Installs a developer-supplied error handler for Open Data Services errors.
Important This Open Data Services function or macro is only supported in Microsoft® SQL Server™ version 7.0 for backward compatibility.
For more information about Open Data Services functions or macros supported for backward compatibility, see Open Data Services (Level 3).
SRV_ERRHANDLE_PROC srv_errhandle ( SRV_ERRHANDLE_PROC handler );
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, return an error, or 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 | Description |
---|---|
server | The affected Open Data Services server application process. |
srvproc | The affected client process. |
srverror | The Open Data Services error number. The lower 16 bits is the ODS 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 | Description |
---|---|
SRV_CONTINUE | Pass a nonfatal 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.
srv_sendmsg |