mirror of
https://git.wownero.com/wownero/wownero.git
synced 2024-08-15 01:03:23 +00:00
BlockchainLMDB: Add DB error to exception
This commit is contained in:
parent
a49c355cae
commit
c5932eb5ea
1 changed files with 7 additions and 5 deletions
|
@ -208,11 +208,6 @@ const char* const LMDB_HF_VERSIONS = "hf_versions";
|
||||||
|
|
||||||
const char* const LMDB_PROPERTIES = "properties";
|
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)
|
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;
|
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
|
} // anonymous namespace
|
||||||
|
|
||||||
#define CURSOR(name) \
|
#define CURSOR(name) \
|
||||||
|
|
Loading…
Reference in a new issue