Unverified Commit 719f784b authored by Copilot's avatar Copilot Committed by GitHub
Browse files

Improve error logs for HTTP parsing failures (#366)



* Initial plan

* Change debug! to error! for HTTP parsing failures

Co-authored-by: default avatarNugine <30099658+Nugine@users.noreply.github.com>

---------

Co-authored-by: default avatarcopilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: default avatarNugine <30099658+Nugine@users.noreply.github.com>
parent ba03ddb5
Loading
Loading
Loading
Loading
+3 −3
Original line number Diff line number Diff line
@@ -10,7 +10,7 @@ use std::fmt;
use std::str::FromStr;

use stdx::string::StringExt;
use tracing::debug;
use tracing::{debug, error};

fn missing_header(name: &HeaderName) -> S3Error {
    invalid_request!("missing header: {}", name.as_str())
@@ -219,7 +219,7 @@ where
    }
    let result = deserialize_xml(&bytes);
    if result.is_err() {
        debug!(?bytes, "malformed xml body");
        error!(?bytes, "malformed xml body");
    }
    result
}
@@ -234,7 +234,7 @@ where
    }
    let result = deserialize_xml(&bytes).map(Some);
    if result.is_err() {
        debug!(?bytes, "malformed xml body");
        error!(?bytes, "malformed xml body");
    }
    result
}
+4 −4
Original line number Diff line number Diff line
@@ -47,7 +47,7 @@ use hyper::StatusCode;
use hyper::Uri;
use hyper::http::HeaderValue;
use mime::Mime;
use tracing::debug;
use tracing::{debug, error};

#[async_trait::async_trait]
pub trait Operation: Send + Sync + 'static {
@@ -207,7 +207,7 @@ pub async fn call(req: &mut Request, ccx: &CallContext<'_>) -> S3Result<Response
    let prep = match prepare(req, ccx).await {
        Ok(op) => op,
        Err(err) => {
            debug!(?err, "failed to prepare");
            error!(?err, "failed to prepare");
            return serialize_error(err, false);
        }
    };
@@ -219,7 +219,7 @@ pub async fn call(req: &mut Request, ccx: &CallContext<'_>) -> S3Result<Response
                    Ok(resp) //
                }
                Err(err) => {
                    debug!(op = %op.name(), ?err, "op returns error");
                    error!(op = %op.name(), ?err, "op returns error");
                    serialize_error(err, false)
                }
            }
@@ -243,7 +243,7 @@ pub async fn call(req: &mut Request, ccx: &CallContext<'_>) -> S3Result<Response
                    extensions: s3_resp.extensions,
                }),
                Err(err) => {
                    debug!(?err, "custom route returns error");
                    error!(?err, "custom route returns error");
                    serialize_error(err, false)
                }
            }