diff --git a/nano/core_test/block_store.cpp b/nano/core_test/block_store.cpp index 573f412eb4..8740eef667 100644 --- a/nano/core_test/block_store.cpp +++ b/nano/core_test/block_store.cpp @@ -674,8 +674,15 @@ TEST (mdb_block_store, bad_path) GTEST_SKIP (); } nano::logger_mt logger; - nano::store::lmdb::component store (logger, boost::filesystem::path ("///"), nano::dev::constants); - ASSERT_TRUE (store.init_error ()); + try + { + nano::store::lmdb::component store (logger, boost::filesystem::path ("///"), nano::dev::constants); + } + catch (std::runtime_error &) + { + return; + } + ASSERT_TRUE (false); } TEST (block_store, DISABLED_already_open) // File can be shared diff --git a/nano/store/lmdb/lmdb_env.cpp b/nano/store/lmdb/lmdb_env.cpp index b34289e7f1..6478ace99a 100644 --- a/nano/store/lmdb/lmdb_env.cpp +++ b/nano/store/lmdb/lmdb_env.cpp @@ -54,13 +54,8 @@ void nano::store::lmdb::env::init (bool & error_a, boost::filesystem::path const auto status4 (mdb_env_open (environment, path_a.string ().c_str (), environment_flags, 00600)); if (status4 != 0) { - std::cerr << "Could not open lmdb environment: " << status4; - char * error_str (mdb_strerror (status4)); - if (error_str) - { - std::cerr << ", " << error_str; - } - std::cerr << std::endl; + std::string message = "Could not open lmdb environment(" + std::to_string (status4) + "): " + mdb_strerror (status4); + throw std::runtime_error (message); } release_assert (status4 == 0); error_a = status4 != 0;