Skip to content

Commit 904a05f

Browse files
committed
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.
1 parent 569e910 commit 904a05f

File tree

1 file changed

+16
-6
lines changed

1 file changed

+16
-6
lines changed

src/chain/esplora.rs

Lines changed: 16 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -144,12 +144,22 @@ impl EsploraChainSource {
144144
},
145145
Err(e) => match *e {
146146
esplora_client::Error::Reqwest(he) => {
147-
log_error!(
148-
self.logger,
149-
"{} of on-chain wallet failed due to HTTP connection error: {}",
150-
if incremental_sync { "Incremental sync" } else { "Sync" },
151-
he
152-
);
147+
if let Some(status_code) = he.status() {
148+
log_error!(
149+
self.logger,
150+
"{} of on-chain wallet failed due to HTTP {} error: {}",
151+
if incremental_sync { "Incremental sync" } else { "Sync" },
152+
status_code,
153+
he,
154+
);
155+
} else {
156+
log_error!(
157+
self.logger,
158+
"{} of on-chain wallet failed due to HTTP error: {}",
159+
if incremental_sync { "Incremental sync" } else { "Sync" },
160+
he,
161+
);
162+
}
153163
Err(Error::WalletOperationFailed)
154164
},
155165
_ => {

0 commit comments

Comments
 (0)