From 7df173668c78591630e5ec779a41c95561676d8b Mon Sep 17 00:00:00 2001 From: Leo Nash Date: Thu, 30 Apr 2026 23:10:56 +0000 Subject: [PATCH 1/2] Log the error returned from `SqliteStore::new` and `fs::create_dir_all` This matches the logging done when setting up a VSS store. --- src/builder.rs | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/src/builder.rs b/src/builder.rs index 04ee39244..d2ac84863 100644 --- a/src/builder.rs +++ b/src/builder.rs @@ -628,6 +628,7 @@ impl NodeBuilder { /// Builds a [`Node`] instance with a [`SqliteStore`] backend and according to the options /// previously configured. pub fn build(&self, node_entropy: NodeEntropy) -> Result { + let logger = setup_logger(&self.log_writer_config, &self.config)?; let storage_dir_path = self.config.storage_dir_path.clone(); fs::create_dir_all(storage_dir_path.clone()) .map_err(|_| BuildError::StoragePathAccessFailed)?; @@ -636,18 +637,24 @@ impl NodeBuilder { Some(io::sqlite_store::SQLITE_DB_FILE_NAME.to_string()), Some(io::sqlite_store::KV_TABLE_NAME.to_string()), ) - .map_err(|_| BuildError::KVStoreSetupFailed)?; + .map_err(|e| { + log_error!(logger, "Failed to setup Sqlite store: {}", e); + BuildError::KVStoreSetupFailed + })?; self.build_with_store(node_entropy, kv_store) } /// Builds a [`Node`] instance with a [`FilesystemStore`] backend and according to the options /// previously configured. pub fn build_with_fs_store(&self, node_entropy: NodeEntropy) -> Result { + let logger = setup_logger(&self.log_writer_config, &self.config)?; let mut storage_dir_path: PathBuf = self.config.storage_dir_path.clone().into(); storage_dir_path.push("fs_store"); - fs::create_dir_all(storage_dir_path.clone()) - .map_err(|_| BuildError::StoragePathAccessFailed)?; + fs::create_dir_all(storage_dir_path.clone()).map_err(|e| { + log_error!(logger, "Failed to setup Filesystem store: {}", e); + BuildError::StoragePathAccessFailed + })?; let kv_store = FilesystemStore::new(storage_dir_path); self.build_with_store(node_entropy, kv_store) } From 5cd7eed1730fe3cbc8023434fff0bcdbc5a5cf4a Mon Sep 17 00:00:00 2001 From: Leo Nash Date: Mon, 4 May 2026 18:39:08 +0000 Subject: [PATCH 2/2] Add `NodeBuilder::build_with_store_and_logger` This internal method allows us to avoid instantiating the logger twice during the creation of a `Node`. --- src/builder.rs | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/src/builder.rs b/src/builder.rs index d2ac84863..54a2f51ab 100644 --- a/src/builder.rs +++ b/src/builder.rs @@ -641,7 +641,7 @@ impl NodeBuilder { log_error!(logger, "Failed to setup Sqlite store: {}", e); BuildError::KVStoreSetupFailed })?; - self.build_with_store(node_entropy, kv_store) + self.build_with_store_and_logger(node_entropy, kv_store, logger) } /// Builds a [`Node`] instance with a [`FilesystemStore`] backend and according to the options @@ -656,7 +656,7 @@ impl NodeBuilder { BuildError::StoragePathAccessFailed })?; let kv_store = FilesystemStore::new(storage_dir_path); - self.build_with_store(node_entropy, kv_store) + self.build_with_store_and_logger(node_entropy, kv_store, logger) } /// Builds a [`Node`] instance with a [VSS] backend and according to the options @@ -687,7 +687,7 @@ impl NodeBuilder { BuildError::KVStoreSetupFailed })?; - self.build_with_store(node_entropy, vss_store) + self.build_with_store_and_logger(node_entropy, vss_store, logger) } /// Builds a [`Node`] instance with a [VSS] backend and according to the options @@ -724,7 +724,7 @@ impl NodeBuilder { BuildError::KVStoreSetupFailed })?; - self.build_with_store(node_entropy, vss_store) + self.build_with_store_and_logger(node_entropy, vss_store, logger) } /// Builds a [`Node`] instance with a [VSS] backend and according to the options @@ -751,7 +751,7 @@ impl NodeBuilder { BuildError::KVStoreSetupFailed })?; - self.build_with_store(node_entropy, vss_store) + self.build_with_store_and_logger(node_entropy, vss_store, logger) } /// Builds a [`Node`] instance with a [VSS] backend and according to the options @@ -776,7 +776,7 @@ impl NodeBuilder { BuildError::KVStoreSetupFailed })?; - self.build_with_store(node_entropy, vss_store) + self.build_with_store_and_logger(node_entropy, vss_store, logger) } /// Builds a [`Node`] instance according to the options previously configured. @@ -785,6 +785,12 @@ impl NodeBuilder { ) -> Result { let logger = setup_logger(&self.log_writer_config, &self.config)?; + self.build_with_store_and_logger(node_entropy, kv_store, logger) + } + + fn build_with_store_and_logger( + &self, node_entropy: NodeEntropy, kv_store: S, logger: Arc, + ) -> Result { let runtime = if let Some(handle) = self.runtime_handle.as_ref() { Arc::new(Runtime::with_handle(handle.clone(), Arc::clone(&logger))) } else {