aboutsummaryrefslogtreecommitdiff
path: root/src/api/s3/bucket.rs
diff options
context:
space:
mode:
authorAlex Auvolat <alex@adnab.me>2022-05-13 19:18:51 +0200
committerAlex Auvolat <alex@adnab.me>2022-05-13 19:18:51 +0200
commitea325d78d36d19f59a0849ace1f4567e2b095bd7 (patch)
treebfc05dd1f8df3d1fae84a1af433f4ae56dbc2c31 /src/api/s3/bucket.rs
parentec16d166f940f59098ae5cc0c0b3d8298f1bcc78 (diff)
downloadgarage-ea325d78d36d19f59a0849ace1f4567e2b095bd7.tar.gz
garage-ea325d78d36d19f59a0849ace1f4567e2b095bd7.zip
More error refactoring
Diffstat (limited to 'src/api/s3/bucket.rs')
-rw-r--r--src/api/s3/bucket.rs5
1 files changed, 3 insertions, 2 deletions
diff --git a/src/api/s3/bucket.rs b/src/api/s3/bucket.rs
index d4a6b0cb..1304cc07 100644
--- a/src/api/s3/bucket.rs
+++ b/src/api/s3/bucket.rs
@@ -14,6 +14,7 @@ use garage_util::crdt::*;
use garage_util::data::*;
use garage_util::time::*;
+use crate::common_error::CommonError;
use crate::s3::error::*;
use crate::s3::xml as s3_xml;
use crate::signature::verify_signed_content;
@@ -158,7 +159,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::BucketAlreadyExists);
+ return Err(CommonError::BucketAlreadyExists.into());
}
} else {
// Create the bucket!
@@ -239,7 +240,7 @@ pub async fn handle_delete_bucket(
)
.await?;
if !objects.is_empty() {
- return Err(Error::BucketNotEmpty);
+ return Err(CommonError::BucketNotEmpty.into());
}
// --- done checking, now commit ---