aboutsummaryrefslogtreecommitdiff
path: root/src/api/k2v/api_server.rs
diff options
context:
space:
mode:
authorAlex <lx@deuxfleurs.fr>2025-01-29 18:25:44 +0000
committerAlex <lx@deuxfleurs.fr>2025-01-29 18:25:44 +0000
commitab71544499679685877cd7bd683ba4556b4331f2 (patch)
tree7445be8428cfccd0996109b23a06ec2b7b959f40 /src/api/k2v/api_server.rs
parent991edbe02c9493e932614f1b801fe2bbdf020c53 (diff)
parent9f3c7c3720d323bc9df3892197e6da5d89d1b84a (diff)
downloadgarage-ab71544499679685877cd7bd683ba4556b4331f2.tar.gz
garage-ab71544499679685877cd7bd683ba4556b4331f2.zip
Merge pull request 'api: better handling of helper errors to distinguish error codes' (#942) from fix-getkeyinfo-404 into main
Reviewed-on: https://git.deuxfleurs.fr/Deuxfleurs/garage/pulls/942
Diffstat (limited to 'src/api/k2v/api_server.rs')
-rw-r--r--src/api/k2v/api_server.rs6
1 files changed, 4 insertions, 2 deletions
diff --git a/src/api/k2v/api_server.rs b/src/api/k2v/api_server.rs
index f2a3942e..de6e5f06 100644
--- a/src/api/k2v/api_server.rs
+++ b/src/api/k2v/api_server.rs
@@ -90,11 +90,13 @@ impl ApiHandler for K2VApiServer {
let bucket_id = garage
.bucket_helper()
.resolve_bucket(&bucket_name, &api_key)
- .await?;
+ .await
+ .map_err(pass_helper_error)?;
let bucket = garage
.bucket_helper()
.get_existing_bucket(bucket_id)
- .await?;
+ .await
+ .map_err(helper_error_as_internal)?;
let bucket_params = bucket.state.into_option().unwrap();
let allowed = match endpoint.authorization_type() {