BlockchainLMDB: Add DB error to exception

This commit is contained in:
warptangent 2016-03-03 20:12:45 -08:00
parent a49c355cae
commit c5932eb5ea
1 changed files with 7 additions and 5 deletions

View File

@ -208,11 +208,6 @@ const char* const LMDB_HF_VERSIONS = "hf_versions";
const char* const LMDB_PROPERTIES = "properties";
inline void lmdb_db_open(MDB_txn* txn, const char* name, int flags, MDB_dbi& dbi, const std::string& error_string)
{
if (mdb_dbi_open(txn, name, flags, &dbi))
throw0(cryptonote::DB_OPEN_FAILURE(error_string.c_str()));
}
const std::string lmdb_error(const std::string& error_string, int mdb_res)
{
@ -220,6 +215,13 @@ const std::string lmdb_error(const std::string& error_string, int mdb_res)
return full_string;
}
inline void lmdb_db_open(MDB_txn* txn, const char* name, int flags, MDB_dbi& dbi, const std::string& error_string)
{
if (auto res = mdb_dbi_open(txn, name, flags, &dbi))
throw0(cryptonote::DB_OPEN_FAILURE(lmdb_error(error_string + " : ", res).c_str()));
}
} // anonymous namespace
#define CURSOR(name) \