From 904a05f7eda483e4122a4191620c03d6441f59e4 Mon Sep 17 00:00:00 2001 From: Elias Rohrer Date: Mon, 22 Sep 2025 13:11:23 +0200 Subject: [PATCH] Try to log status code for `reqwest`'s `Request` error kind We attempt to log a status code when `reqwest` returns a `Request` error kind. It might not be the case that the status code would always/ever be set for this error kind. --- src/chain/esplora.rs | 22 ++++++++++++++++------ 1 file changed, 16 insertions(+), 6 deletions(-) diff --git a/src/chain/esplora.rs b/src/chain/esplora.rs index 8e9a4dbd4..2226358c1 100644 --- a/src/chain/esplora.rs +++ b/src/chain/esplora.rs @@ -144,12 +144,22 @@ impl EsploraChainSource { }, Err(e) => match *e { esplora_client::Error::Reqwest(he) => { - log_error!( - self.logger, - "{} of on-chain wallet failed due to HTTP connection error: {}", - if incremental_sync { "Incremental sync" } else { "Sync" }, - he - ); + if let Some(status_code) = he.status() { + log_error!( + self.logger, + "{} of on-chain wallet failed due to HTTP {} error: {}", + if incremental_sync { "Incremental sync" } else { "Sync" }, + status_code, + he, + ); + } else { + log_error!( + self.logger, + "{} of on-chain wallet failed due to HTTP error: {}", + if incremental_sync { "Incremental sync" } else { "Sync" }, + he, + ); + } Err(Error::WalletOperationFailed) }, _ => {