aboutsummaryrefslogtreecommitdiff
path: root/src/api/s3_delete.rs
diff options
context:
space:
mode:
authorAlex <alex@adnab.me>2020-11-08 18:04:52 +0100
committerAlex <alex@adnab.me>2020-11-08 18:04:52 +0100
commit045009da9b7ac4198574bd5aa256c11cfe4ae469 (patch)
treed3014cc2739c5a1bce62ff35efc8417b79ff46ef /src/api/s3_delete.rs
parent54166d2a09f488bff080469160d4df6a78db1a3f (diff)
parenta50fa70d45f8b5af68d23d60c3bac2af4ecceb58 (diff)
downloadgarage-045009da9b7ac4198574bd5aa256c11cfe4ae469.tar.gz
garage-045009da9b7ac4198574bd5aa256c11cfe4ae469.zip
Merge pull request 'Refactor error management in API part' (#10) from error-refactoring into master
Reviewed-on: https://git.deuxfleurs.fr/Deuxfleurs/garage/pulls/10
Diffstat (limited to 'src/api/s3_delete.rs')
-rw-r--r--src/api/s3_delete.rs5
1 files changed, 2 insertions, 3 deletions
diff --git a/src/api/s3_delete.rs b/src/api/s3_delete.rs
index 42216f51..33e47c17 100644
--- a/src/api/s3_delete.rs
+++ b/src/api/s3_delete.rs
@@ -4,12 +4,12 @@ use std::sync::Arc;
use hyper::{Body, Request, Response};
use garage_util::data::*;
-use garage_util::error::Error;
use garage_model::garage::Garage;
use garage_model::object_table::*;
use crate::encoding::*;
+use crate::error::*;
async fn handle_delete_internal(
garage: &Garage,
@@ -85,8 +85,7 @@ pub async fn handle_delete_objects(
) -> Result<Response<Body>, Error> {
let body = hyper::body::to_bytes(req.into_body()).await?;
let cmd_xml = roxmltree::Document::parse(&std::str::from_utf8(&body)?)?;
- let cmd = parse_delete_objects_xml(&cmd_xml)
- .map_err(|e| Error::BadRequest(format!("Invald delete XML query: {}", e)))?;
+ let cmd = parse_delete_objects_xml(&cmd_xml).ok_or_bad_request("Invalid delete XML query")?;
let mut retxml = String::new();
writeln!(&mut retxml, r#"<?xml version="1.0" encoding="UTF-8"?>"#).unwrap();