OpenDBX_Exception man page
OpenDBX::Exception — Exceptions thrown by the OpenDBX classes.
Public Member Functions
Exception (const string &msg, int err, int type) throw ()
Initializes the exception object.
int getCode () const throw ()
Returns the OpenDBX error code related to the error.
int getType () const throw ()
Returns severity indicator.
Exceptions thrown by the OpenDBX classes.
Most calls to methods of OpenDBX objects does throw an exception in case an error occurs in the underlying database library. Additionally to other exceptions which inherit from the STL exception class it will not only contain a translated error message depending on the user settings but also a machine readable error code and an indicator for the severity of the eror.
Norbert Sendetzky firstname.lastname@example.org
Constructor & Destructor Documentation
OpenDBX::Exception::Exception (const string & msg, int err, int type)
Initializes the exception object. The first parameter, the error message, should be the human readable description of what has gone wrong. It should also be already translated to the language of the user which depends on his environment settings when e.g GNU gettext is used. Errors thrown by the OpenDBX C++ library are already translated.
The OpenDBX error code is the machine readable code for the error which has been occured.
The last parameter must be a value indicating the severity of the thrown error. If the value is smaller than zero, the error is fatal and the connection to the database can't be recovered and has to be closed and reopened before the application can try to continue. In case it's greater than zero, the operation failed but the database connection is still usable. Zero represents a successful operation and shouldn't be used because an exception should only be thrown in error conditions.
msg Human readable error message
err OpenDBX error code
type Severity of error (negative: fatal, zero: success, positive: warning)
Member Function Documentation
int OpenDBX::Exception::getCode () const
Returns the OpenDBX error code related to the error. The machine readable code describing the error which occured can be used by the application to act differently depending on the specific error. Currently defined codes are:
The operation was successfully completed.
An error occured in the native database library or in the database server.
The capability isn't available in the currently selected backend.
One of the given parameters is invalid and doesn't match the expectations.
An out of memory condition occured.
The internally allocated memory is unable to store the value.
The backend library wasn't found or loading the library failed.
The required function isn't available or the operation isn't possible in this backend.
The given option is unknown an therefore invalid.
The requested option is read-only and its value can't be changed.
Setting the given option to the new value failed.
Waiting for the result set after sending a statement to the database server failed.
The requested functionality isn't supported by the backend.
The internal data structure which should store the details for accessing the database are invalid.
int OpenDBX::Exception::getType () const
Returns severity indicator. The returned value classifies the error thrown. In case it is negative, the error is fatal (e.g. the connection to the database is lost) and the application can't continue without closing and reopening the connection.
If the value is positive, the database wasn't able to perform the requested action but the connection is still OK and can be used to send more requests to the database. On zero, everything was successfull and no error occured. This shouldn't happen when catching one of these exceptions.
Severity of error (negative: fatal, zero: success, positive: warning)
Generated automatically by Doxygen for opendbx from the source code.