,I'Berkeley DB: DbException[P

DbException





#include <db_cxx.h>

"DbException::DbException(int err);2DbException::DbException(const char *description);6DbException::DbException(const char *prefix, int err);-DbException::DbException(const char *prefix1," const char *prefix2, int err);





Description



CThis manual page describes the DbException class and how it is usedby the various Db* classes.

IMost methods in the Db classes return an int but also throw an exception.@This allows for two different error behaviors, that are known aserror models.HBy default, the error model is configured to throw an exception whenevera serious error occurs.CThis generally allows for cleaner logic for transaction processing,1as a try block can surround a single transaction.BAlternatively, the error model can be set to not throw exceptions,Dand instead request the individual function to return an error code.vThe error model can be changed using the DbEnv::set_error_modelmethod.

CA DbException object contains an informational string and an errno.qThe errno can be obtained by using DbException::get_errno.vThe informational string can be obtained by using DbException::what.

FWe expect in the future that this class will inherit from the standardCclass exception, but certain language implementation bugs currentlyprevent this on some platforms.

ESome methods may return non-zero values without issuing an exception.HThis occurs in situations that are not normally considered an error, butiwhen some informational status is returned. For example, Db::getIreturns DB_NOTFOUND when a requested key does not appear in the database.



Class

DbException



See Also

MDbException::get_errnoandDDbException::what.
ÿÿ