|
DbException
|
|
#include <db_cxx.h>
class DbException {
DbException(int err);
DbException(const char *description);
DbException(const char *prefix, int err);
DbException(const char *prefix1, const char *prefix2, int err);
};
Description
This manual page describes the DbException class and how it is used
by the various Berkeley DB classes.
Most methods in the Berkeley DB classes return an int, but also throw an
exception. This allows for two different error behaviors. By default,
the Berkeley DB C++ API is configured to throw an exception whenever a serious
error occurs. This generally allows for cleaner logic for transaction
processing because a try block can surround a single transaction.
Alternatively, Berkeley DB can be configured to not throw exceptions, and
instead have the individual function return an error code, by setting
the constructor flags for the Db and DbEnv objects.
A DbException object contains an informational string and an errno.
The errno can be obtained by using DbException::get_errno.
The informational string can be obtained by using DbException::what.
We expect in the future that this class will inherit from the standard
class exception, but certain language implementation bugs currently
prevent this on some platforms.
Some methods may return non-zero values without issuing an exception.
This occurs in situations that are not normally considered an error, but
when some informational status is returned. For example, Db::get
returns DB_NOTFOUND when a requested key does not appear in the database.
Class
DbException
See Also
DbException::get_errno,
DbException::what,
and
DbMemoryException
Copyright Sleepycat Software
|