diff options
author | Alex Auvolat <alex@adnab.me> | 2022-01-05 17:07:36 +0100 |
---|---|---|
committer | Alex Auvolat <alex@adnab.me> | 2022-01-05 17:07:36 +0100 |
commit | 168a90dfb5489d465d64f066f375e5d06bc1f08c (patch) | |
tree | 7fd1430cb52cf77a654ba93324b40c05d936f5a8 /src/api/s3_bucket.rs | |
parent | fb1e31add06ee3739fc95099aa5ffe96cf011e9c (diff) | |
download | garage-168a90dfb5489d465d64f066f375e5d06bc1f08c.tar.gz garage-168a90dfb5489d465d64f066f375e5d06bc1f08c.zip |
Fix some error codes
Diffstat (limited to 'src/api/s3_bucket.rs')
-rw-r--r-- | src/api/s3_bucket.rs | 10 |
1 files changed, 2 insertions, 8 deletions
diff --git a/src/api/s3_bucket.rs b/src/api/s3_bucket.rs index ea7e0b8c..fb3e982d 100644 --- a/src/api/s3_bucket.rs +++ b/src/api/s3_bucket.rs @@ -153,10 +153,7 @@ pub async fn handle_create_bucket( // otherwise return a forbidden error. let kp = api_key.bucket_permissions(&bucket_id); if !(kp.allow_write || kp.allow_owner) { - return Err(Error::Forbidden(format!( - "Key {} does not have write or owner permissions on bucket {}", - api_key.key_id, bucket_name - ))); + return Err(Error::BucketAlreadyExists); } } else { // Create the bucket! @@ -231,10 +228,7 @@ pub async fn handle_delete_bucket( .get_range(&bucket_id, None, Some(DeletedFilter::NotDeleted), 10) .await?; if !objects.is_empty() { - return Err(Error::BadRequest(format!( - "Bucket {} is not empty", - bucket_name - ))); + return Err(Error::BucketNotEmpty); } // --- done checking, now commit --- |