<!--$Id: except_class.so,v 10.38 2004/09/28 15:04:19 bostic Exp $--> <!--Copyright (c) 1997,2007 Oracle. All rights reserved.--> <!--See the file LICENSE for redistribution information.--> <html> <head> <title>Berkeley DB: DbException</title> <meta name="description" content="Berkeley DB: An embedded database programmatic toolkit."> <meta name="keywords" content="embedded,database,programmatic,toolkit,btree,hash,hashing,transaction,transactions,locking,logging,access method,access methods,Java,C,C++"> </head> <body bgcolor=white> <table width="100%"><tr valign=top> <td> <h3>DbException</h3> </td> <td align=right> <a href="../../db46-devel-4.6.21/api_cxx/api_core.html"><img src="../../db46-devel-4.6.21/images/api.gif" alt="API"></a> <a href="../../db46-devel-4.6.21/ref/toc.html"><img src="../../db46-devel-4.6.21/images/ref.gif" alt="Ref"></a></td> </tr></table> <hr size=1 noshade> <tt> <h3><pre> #include <db_cxx.h> <p> class DbException { public: int get_errno() const; virtual const char *what() const; DbEnv *get_env() const; }; </pre></h3> <hr size=1 noshade> <h3>Description: DbException</h3> <p>This information describes the DbException class and how it is used by the various Berkeley DB classes.</p> <p>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 <a href="../../db46-devel-4.6.21/api_cxx/env_class.html#DB_CXX_NO_EXCEPTIONS">DB_CXX_NO_EXCEPTIONS</a> for the <a href="../../db46-devel-4.6.21/api_cxx/db_class.html">Db</a> and <a href="../../db46-devel-4.6.21/api_cxx/env_class.html">DbEnv</a> constructors.</p> <p>A DbException object contains an informational string, an errno, and a reference to the environment from which the exception was thrown. The errno can be obtained by using DbException::get_errno, and can be used, in standard cases, to determine the type of the exception. The informational string can be obtained by using DbException::what. And, the environment can be obtained using DbException::get_env.</p> <p>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.</p> <p>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, <a href="../../db46-devel-4.6.21/api_cxx/db_get.html">Db::get</a> returns <a href="../../db46-devel-4.6.21/ref/program/errorret.html#DB_NOTFOUND">DB_NOTFOUND</a> when a requested key does not appear in the database.</p> </tt> <table width="100%"><tr><td><br></td><td align=right> <a href="../../db46-devel-4.6.21/api_cxx/api_core.html"><img src="../../db46-devel-4.6.21/images/api.gif" alt="API"></a><a href="../../db46-devel-4.6.21/ref/toc.html"><img src="../../db46-devel-4.6.21/images/ref.gif" alt="Ref"></a> </td></tr></table> <p><font size=1>Copyright (c) 1996,2007 Oracle. All rights reserved.</font> </body> </html>