Note: instantiating a CDBWrapper can throw other errors such as a fs::filesystem_error from here, but I suppose that is not something the user can recover from with a reindex so not catching that here seems correct.
I think it logging the dbwrapper_error would be useful though?
<details>
<summary>git diff on 1bec418e77</summary>
diff --git a/src/node/chainstate.cpp b/src/node/chainstate.cpp
index 76094105fa..b9c3981910 100644
--- a/src/node/chainstate.cpp
+++ b/src/node/chainstate.cpp
@@ -48,8 +48,10 @@ static ChainstateLoadResult CompleteChainstateInitialization(
.memory_only = options.block_tree_db_in_memory,
.wipe_data = options.wipe_block_tree_db,
.options = chainman.m_options.block_tree_db});
- } catch (dbwrapper_error&) {
- return {ChainstateLoadStatus::FAILURE, _("Error opening block database")};
+ } catch (dbwrapper_error& err) {
+ auto msg{_("Error opening block database")};
+ LogError("%s: %s\n", msg.original, err.what());
+ return {ChainstateLoadStatus::FAILURE, msg};
}
if (options.wipe_block_tree_db) {
@@ -116,8 +118,10 @@ static ChainstateLoadResult CompleteChainstateInitialization(
/*cache_size_bytes=*/chainman.m_total_coinsdb_cache * init_cache_fraction,
/*in_memory=*/options.coins_db_in_memory,
/*should_wipe=*/options.wipe_chainstate_db);
- } catch (dbwrapper_error&) {
- return {ChainstateLoadStatus::FAILURE, _("Error opening coins database")};
+ } catch (dbwrapper_error& err) {
+ auto msg{_("Error opening coins database")};
+ LogError("%s: %s\n", msg.original, err.what());
+ return {ChainstateLoadStatus::FAILURE, msg};
}
if (options.coins_error_cb) {
</details>