Skip to content

Commit 04c9f12

Browse files
authored
only log plane client errors for 5xx-level responses (#859)
1 parent a9d5ccf commit 04c9f12

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

common/src/lib.rs

+9-1
Original file line numberDiff line numberDiff line change
@@ -217,8 +217,16 @@ async fn get_response<T: DeserializeOwned>(response: Response) -> Result<T, Plan
217217
Ok(response.json::<T>().await?)
218218
} else {
219219
let url = response.url().to_string();
220-
tracing::error!(?url, "Got error response from API server.");
221220
let status = response.status();
221+
if status.is_server_error() {
222+
tracing::error!(?url, ?status, "Got 5xx response from Plane API server.");
223+
} else {
224+
tracing::warn!(
225+
?url,
226+
?status,
227+
"Got unsuccessful response from Plane API server."
228+
);
229+
}
222230
if let Ok(api_error) = response.json::<ApiError>().await {
223231
Err(PlaneClientError::PlaneError(api_error, status))
224232
} else {

0 commit comments

Comments
 (0)