From 65070f3c05775f6692f4a16b6a304991d0510301 Mon Sep 17 00:00:00 2001 From: Alex Auvolat Date: Fri, 15 Oct 2021 11:05:09 +0200 Subject: Improvements to CLI and various fixes for netapp version --- src/api/Cargo.toml | 2 +- src/api/error.rs | 8 ++++++-- 2 files changed, 7 insertions(+), 3 deletions(-) (limited to 'src/api') diff --git a/src/api/Cargo.toml b/src/api/Cargo.toml index 8b5118cd..f346c6cc 100644 --- a/src/api/Cargo.toml +++ b/src/api/Cargo.toml @@ -35,7 +35,7 @@ tokio = { version = "1.0", default-features = false, features = ["rt", "rt-multi http = "0.2" httpdate = "0.3" http-range = "0.1" -hyper = "0.14" +hyper = { version = "0.14", features = ["server", "http1", "runtime", "tcp", "stream"] } percent-encoding = "2.1.0" roxmltree = "0.14" serde = { version = "1.0", features = ["derive"] } diff --git a/src/api/error.rs b/src/api/error.rs index 7d97366e..35fa404f 100644 --- a/src/api/error.rs +++ b/src/api/error.rs @@ -82,7 +82,9 @@ impl Error { match self { Error::NotFound => StatusCode::NOT_FOUND, Error::Forbidden(_) => StatusCode::FORBIDDEN, - Error::InternalError(GarageError::Rpc(_)) => StatusCode::SERVICE_UNAVAILABLE, + Error::InternalError( + GarageError::Timeout | GarageError::RemoteError(_) | GarageError::TooManyErrors(_), + ) => StatusCode::SERVICE_UNAVAILABLE, Error::InternalError(_) | Error::Hyper(_) | Error::Http(_) => { StatusCode::INTERNAL_SERVER_ERROR } @@ -95,7 +97,9 @@ impl Error { Error::NotFound => "NoSuchKey", Error::Forbidden(_) => "AccessDenied", Error::AuthorizationHeaderMalformed(_) => "AuthorizationHeaderMalformed", - Error::InternalError(GarageError::Rpc(_)) => "ServiceUnavailable", + Error::InternalError( + GarageError::Timeout | GarageError::RemoteError(_) | GarageError::TooManyErrors(_), + ) => "ServiceUnavailable", Error::InternalError(_) | Error::Hyper(_) | Error::Http(_) => "InternalError", _ => "InvalidRequest", } -- cgit v1.2.3