From 3586c7257cf9abe095f934227794627f8cdf7182 Mon Sep 17 00:00:00 2001 From: Alex Auvolat Date: Mon, 10 Jan 2022 14:10:04 +0100 Subject: [PATCH] Clarify error message --- src/api/s3_bucket.rs | 3 ++- src/api/s3_router.rs | 16 ++++++++-------- 2 files changed, 10 insertions(+), 9 deletions(-) diff --git a/src/api/s3_bucket.rs b/src/api/s3_bucket.rs index 3766bf86..425d2998 100644 --- a/src/api/s3_bucket.rs +++ b/src/api/s3_bucket.rs @@ -127,7 +127,8 @@ pub async fn handle_create_bucket( if let Some(location_constraint) = cmd { if location_constraint != garage.config.s3_api.s3_region { return Err(Error::BadRequest(format!( - "Buckets must be created in region {}", + "Cannot satisfy location constraint `{}`: buckets can only be created in region `{}`", + location_constraint, garage.config.s3_api.s3_region ))); } diff --git a/src/api/s3_router.rs b/src/api/s3_router.rs index e0264333..234f77f0 100644 --- a/src/api/s3_router.rs +++ b/src/api/s3_router.rs @@ -1015,14 +1015,14 @@ mod tests { )* }}; - (@actual_method HEAD) => {{ "HEAD" }}; - (@actual_method GET) => {{ "GET" }}; - (@actual_method OWNER_GET) => {{ "GET" }}; - (@actual_method PUT) => {{ "PUT" }}; - (@actual_method OWNER_PUT) => {{ "PUT" }}; - (@actual_method POST) => {{ "POST" }}; - (@actual_method DELETE) => {{ "DELETE" }}; - (@actual_method OWNER_DELETE) => {{ "DELETE" }}; + (@actual_method HEAD) => {{ "HEAD" }}; + (@actual_method GET) => {{ "GET" }}; + (@actual_method OWNER_GET) => {{ "GET" }}; + (@actual_method PUT) => {{ "PUT" }}; + (@actual_method OWNER_PUT) => {{ "PUT" }}; + (@actual_method POST) => {{ "POST" }}; + (@actual_method DELETE) => {{ "DELETE" }}; + (@actual_method OWNER_DELETE) => {{ "DELETE" }}; (@auth HEAD $uri:expr) => {{ assert_eq!(parse("HEAD", concat!("/my_bucket", $uri), None, None).authorization_type(),