Skip to content

Commit 356ae43

Browse files
committed
Print timeout error when http request timed out
1 parent 33a1771 commit 356ae43

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

node/src/utils/rpc_client.rs

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -255,7 +255,13 @@ impl HttpRPCClient {
255255
.json(payload)
256256
.send()
257257
.await
258-
.map_err(|e| anyhow::anyhow!("Failed to send HTTP request: {e}"))?;
258+
.map_err(|e| {
259+
if e.is_timeout() {
260+
anyhow::anyhow!("HttpRPCClient: request timed out: {e}")
261+
} else {
262+
anyhow::anyhow!("HttpRPCClient: failed to send HTTP request: {e}")
263+
}
264+
})?;
259265

260266
if response.status() == http::StatusCode::UNAUTHORIZED {
261267
tracing::debug!("HttpRPCClient 401 error, recreating client");

0 commit comments

Comments
 (0)