1
0
mirror of https://github.com/MariaDB/server.git synced 2025-11-30 05:23:50 +03:00

the exception class is implemented, and for db.cpp and dbenv.cpp it is called. Still need to do exceptions for dbc.cpp dbt.cpp txn.cpp. Addresses #215.

git-svn-id: file:///svn/tokudb@1301 c7de825b-a66e-492c-adef-691d508d4ae1
This commit is contained in:
Bradley C. Kuszmaul
2007-12-20 23:47:44 +00:00
parent 80b5a4758b
commit 1237b38549
4 changed files with 92 additions and 18 deletions

38
cxx/exception.cpp Normal file
View File

@@ -0,0 +1,38 @@
#include <db.h>
#include <db_cxx.h>
DbException::~DbException() throw()
{
if (the_what!=0) {
delete [] the_what;
}
}
DbException::DbException(int err)
: the_err(err),
the_env(0)
{
FillTheWhat();
}
void DbException::FillTheWhat(void)
{
if (the_err!=0) {
the_what = strdup(db_strerror(the_err));
}
}
int DbException::get_errno() const
{
return the_err;
}
const char *DbException::what() const throw()
{
return the_what;
}
DbEnv *DbException::get_env() const
{
return the_env;
}