Skip to content

Commit

Permalink
fix: log client errors (#289)
Browse files Browse the repository at this point in the history
  • Loading branch information
chris13524 committed Nov 28, 2023
1 parent ccb9a2e commit b2acd19
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions src/error.rs
Original file line number Diff line number Diff line change
Expand Up @@ -184,7 +184,7 @@ pub enum Error {

impl IntoResponse for Error {
fn into_response(self) -> Response {
warn!("responding with error: {self:?}");
info!("responding with error: {self:?}");
let response = match &self {
Error::BadDeviceToken(e) => crate::handlers::Response::new_failure(StatusCode::BAD_REQUEST, vec![
ResponseError {
Expand Down Expand Up @@ -568,8 +568,12 @@ impl IntoResponse for Error {
}
}.into_response();

if response.status().is_client_error() {
warn!("HTTP Client Error: {self:?}");
}

if response.status().is_server_error() {
error!("Internal Server Error: {self:?}");
error!("HTTP Server Error: {self:?}");
}

response
Expand Down

0 comments on commit b2acd19

Please sign in to comment.