Skip to content

Commit a30908f

Browse files
committed
chore: log error response from data node
1 parent 3c723ee commit a30908f

File tree

1 file changed

+15
-2
lines changed

1 file changed

+15
-2
lines changed

crates/common/src/json_client.rs

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ use crate::types::ApiResult;
99
use axum::Json;
1010
use reqwest::{Client, Method, Url};
1111
use serde::de::DeserializeOwned;
12-
use tracing::info;
12+
use tracing::{error, info};
1313

1414
#[derive(Clone)]
1515
pub struct JsonClient {
@@ -46,7 +46,20 @@ impl JsonClient {
4646
return Err(BlockfrostError::not_found());
4747
}
4848

49-
let body = resp.json::<T>().await?;
49+
let status = resp.status();
50+
let body_text = resp.text().await?;
51+
52+
let body: T = serde_json::from_str(&body_text).map_err(|e| {
53+
error!(
54+
path,
55+
url = %url_str,
56+
status = %status,
57+
response_body = %body_text,
58+
error = %e,
59+
"JsonClient failed to parse response"
60+
);
61+
e
62+
})?;
5063

5164
Ok(Json(body))
5265
}

0 commit comments

Comments
 (0)