Skip to content

Commit

Permalink
only log plane client errors for 5xx-level responses (#859)
Browse files Browse the repository at this point in the history
  • Loading branch information
rolyatmax authored Jan 17, 2025
1 parent a9d5ccf commit 04c9f12
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion common/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -217,8 +217,16 @@ async fn get_response<T: DeserializeOwned>(response: Response) -> Result<T, Plan
Ok(response.json::<T>().await?)
} else {
let url = response.url().to_string();
tracing::error!(?url, "Got error response from API server.");
let status = response.status();
if status.is_server_error() {
tracing::error!(?url, ?status, "Got 5xx response from Plane API server.");
} else {
tracing::warn!(
?url,
?status,
"Got unsuccessful response from Plane API server."
);
}
if let Ok(api_error) = response.json::<ApiError>().await {
Err(PlaneClientError::PlaneError(api_error, status))
} else {
Expand Down

0 comments on commit 04c9f12

Please sign in to comment.