Unverified Commit 0786f8d5 authored by Nugine's avatar Nugine
Browse files

s3s: ops: catch error

parent c15dbdec
Loading
Loading
Loading
Loading
+7 −1
Original line number Diff line number Diff line
@@ -112,8 +112,14 @@ fn extract_amz_date(hs: &'_ OrderedHeaders<'_>) -> S3Result<Option<AmzDate>> {
        Err(e) => Err(invalid_request!(e, "invalid header: x-amz-date")),
    }
}

pub async fn call(req: &mut Request, s3: &dyn S3, auth: Option<&dyn S3Auth>, base_domain: Option<&str>) -> S3Result<Response> {
    match call_inner(req, s3, auth, base_domain).await {
        Ok(res) => Ok(res),
        Err(err) => serialize_error(err),
    }
}

async fn call_inner(req: &mut Request, s3: &dyn S3, auth: Option<&dyn S3Auth>, base_domain: Option<&str>) -> S3Result<Response> {
    let s3_path = extract_s3_path(req, base_domain)?;
    let qs = extract_qs(req)?;

+2 −2
Original line number Diff line number Diff line
@@ -10,7 +10,7 @@ use std::task::{Context, Poll};

use futures::future::BoxFuture;
use hyper::service::Service;
use tracing::debug;
use tracing::{debug, error};

pub struct S3Service {
    s3: Box<dyn S3>,
@@ -60,7 +60,7 @@ impl S3Service {

        match result {
            Ok(ref res) => debug!(?res),
            Err(ref err) => debug!(?err),
            Err(ref err) => error!(?err),
        }

        result