OpenDBX_Exception - Man Page

Exceptions thrown by the OpenDBX classes.

Synopsis

#include <api.hpp>

Inherits std::runtime_error.

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.

Detailed Description

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.

Author

Norbert Sendetzky norbert@linuxnetworks.de

Version

1.0

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.

Parameters

msg Human readable error message
err OpenDBX error code
type Severity of error (negative: fatal, zero: success, positive: warning)

Returns

Exception

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:

  • ODBX_ERR_SUCCESS
    The operation was successfully completed.
  • ODBX_ERR_BACKEND
    An error occured in the native database library or in the database server.
  • ODBX_ERR_NOCAP
    The capability isn't available in the currently selected backend.
  • ODBX_ERR_PARAM
    One of the given parameters is invalid and doesn't match the expectations.
  • ODBX_ERR_NOMEM
    An out of memory condition occured.
  • ODBX_ERR_SIZE
    The internally allocated memory is unable to store the value.
  • ODBX_ERR_NOTEXIST
    The backend library wasn't found or loading the library failed.
  • ODBX_ERR_NOOP
    The required function isn't available or the operation isn't possible in this backend.
  • ODBX_ERR_OPTION
    The given option is unknown an therefore invalid.
  • ODBX_ERR_OPTRO
    The requested option is read-only and its value can't be changed.
  • ODBX_ERR_OPTWR
    Setting the given option to the new value failed.
  • ODBX_ERR_RESULT
    Waiting for the result set after sending a statement to the database server failed.
  • ODBX_ERR_NOTSUP
    The requested functionality isn't supported by the backend.
  • ODBX_ERR_HANDLE
    The internal data structure which should store the details for accessing the database are invalid.
Returns

Error code

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.

Returns

Severity of error (negative: fatal, zero: success, positive: warning)

Author

Generated automatically by Doxygen for opendbx from the source code.

Info

1.4.6" opendbx