mirror of
https://github.com/monero-project/monero.git
synced 2024-10-01 11:49:47 -04:00
BlockchainLMDB: Add DB error to exception
This commit is contained in:
parent
a49c355cae
commit
c5932eb5ea
@ -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) \
|
||||
|
Loading…
Reference in New Issue
Block a user