API Guide
1-22 Getting Started 601355 Rev A
API Error Handling
The API differentiates between:
Errors that occur during API processing.
Errors that occur within VolServ.
To accomplish this, there are two identifying parts for each
error—the first part identifies where the error occurred—the
second part identifies the specific error.
The API tracks errors by using error handles. There is an error
handle associated with each command, as well as a global error
handle. The global error handle is used to track errors that
cannot be associated directly with a command (e.g., bad handle
type and null handle).
The error code returned by the API is of the form: AAANNN,
where AAA is a three-letter string designating where the error
originates, and NNN is a numeric code designating the specific
error. The three-letter string maps either to an API object or to
VolServ. The numeric code represents either an API internal
error or the VolServ error code returned in the command’s
status.
The following example shows how to access an error code:
int numcode, objcode;
VST_ERROR_CODE errcode;
VST_ERROR_HANDLE errorhandle;
VS_Error_GetFields (errorhandle,
VSID_ERROR_OBJECT,
&objcode,
VSID_ERROR_NUMBER,
&numcode,
VSID_ERROR_CODE,
errcode