diff options
author | Alex Auvolat <alex@adnab.me> | 2022-05-13 19:18:51 +0200 |
---|---|---|
committer | Alex Auvolat <alex@adnab.me> | 2022-05-13 19:18:51 +0200 |
commit | ea325d78d36d19f59a0849ace1f4567e2b095bd7 (patch) | |
tree | bfc05dd1f8df3d1fae84a1af433f4ae56dbc2c31 /src/api/admin/bucket.rs | |
parent | ec16d166f940f59098ae5cc0c0b3d8298f1bcc78 (diff) | |
download | garage-ea325d78d36d19f59a0849ace1f4567e2b095bd7.tar.gz garage-ea325d78d36d19f59a0849ace1f4567e2b095bd7.zip |
More error refactoring
Diffstat (limited to 'src/api/admin/bucket.rs')
-rw-r--r-- | src/api/admin/bucket.rs | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/src/api/admin/bucket.rs b/src/api/admin/bucket.rs index b226c015..c5518e4e 100644 --- a/src/api/admin/bucket.rs +++ b/src/api/admin/bucket.rs @@ -18,6 +18,7 @@ use garage_model::s3::object_table::ObjectFilter; use crate::admin::error::*; use crate::admin::key::ApiBucketKeyPerm; +use crate::common_error::CommonError; use crate::helpers::parse_json_body; pub async fn handle_list_buckets(garage: &Arc<Garage>) -> Result<Response<Body>, Error> { @@ -233,7 +234,7 @@ pub async fn handle_create_bucket( if let Some(alias) = garage.bucket_alias_table.get(&EmptyKey, ga).await? { if alias.state.get().is_some() { - return Err(Error::BucketAlreadyExists); + return Err(CommonError::BucketAlreadyExists.into()); } } } @@ -333,7 +334,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 --- |