Before we proceed to describe other libkavclient functions, we will explain how libkavclient reports failures and how you can check if an error occurred and what kind of error. Most libkavclient functions return an int value, which will be 0 on success and -1 on failure (the functions that do not follow this convention are indentified further in appropriate sections of this manual). If the return value indicates that an error occurred, you can call the kav_get_error function to find out what kind of error it was. This function is defined as follows:
The kav_get_error function returns the libkavclient error code that was set by the last unsuccessful libkavclient function call within the session context ctx. Various libkavclient error codes and their meanings are detailed further in this manual. Note that the libkavclient error code is session context-specific: the values returned by the kav_get_error function in a given context are not affected by unsuccessful libkavclient calls in another context.
Note | |
---|---|
Successful calls to libkavclient functions do not reset the context's error codes to zero. Thus you may only call kav_gete_rror if a previous libkavclient call's return value indicates that an error has occurred. Otherwise you might be getting error codes of some earlier unsuccessful call. |
To get an informative description of an error associated with a libkavclient error code, use the kav_strerror function. It is declared as follows:
The kav_strerror function returns a short textual description of libkavclient error code kav_error. The value of kav_error usually comes from a call to kav_get_error. You should not modify the string returned by kav_strerror.