diff options
author | warptangent <warptangent@tutanota.com> | 2016-03-03 20:12:45 -0800 |
---|---|---|
committer | warptangent <warptangent@tutanota.com> | 2016-03-03 20:15:37 -0800 |
commit | c5932eb5ea7d398ffc6e42506298d0b66ec2fda9 (patch) | |
tree | 54434870b1046c17c721d76a87aa9fc0e0f071cd | |
parent | Blockchain: Omit verbose time stats messages by default (diff) | |
download | monero-c5932eb5ea7d398ffc6e42506298d0b66ec2fda9.tar.xz |
BlockchainLMDB: Add DB error to exception
-rw-r--r-- | src/blockchain_db/lmdb/db_lmdb.cpp | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/src/blockchain_db/lmdb/db_lmdb.cpp b/src/blockchain_db/lmdb/db_lmdb.cpp index 01a36a8da..1da6dcf50 100644 --- a/src/blockchain_db/lmdb/db_lmdb.cpp +++ b/src/blockchain_db/lmdb/db_lmdb.cpp @@ -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) \ |