aboutsummaryrefslogtreecommitdiff
path: root/src/rpc/rpc_server.rs
diff options
context:
space:
mode:
authorAlex Auvolat <alex@adnab.me>2020-11-08 15:04:30 +0100
committerAlex Auvolat <alex@adnab.me>2020-11-08 15:05:28 +0100
commita50fa70d45f8b5af68d23d60c3bac2af4ecceb58 (patch)
treed3014cc2739c5a1bce62ff35efc8417b79ff46ef /src/rpc/rpc_server.rs
parent54166d2a09f488bff080469160d4df6a78db1a3f (diff)
downloadgarage-a50fa70d45f8b5af68d23d60c3bac2af4ecceb58.tar.gz
garage-a50fa70d45f8b5af68d23d60c3bac2af4ecceb58.zip
Refactor error management in API parterror-refactoring
Diffstat (limited to 'src/rpc/rpc_server.rs')
-rw-r--r--src/rpc/rpc_server.rs5
1 files changed, 4 insertions, 1 deletions
diff --git a/src/rpc/rpc_server.rs b/src/rpc/rpc_server.rs
index 4386d733..4113f15b 100644
--- a/src/rpc/rpc_server.rs
+++ b/src/rpc/rpc_server.rs
@@ -61,7 +61,10 @@ where
let err_str = format!("{}", e);
let rep_bytes = rmp_to_vec_all_named::<Result<M, String>>(&Err(err_str))?;
let mut err_response = Response::new(Body::from(rep_bytes));
- *err_response.status_mut() = e.http_status_code();
+ *err_response.status_mut() = match e {
+ Error::BadRPC(_) => StatusCode::BAD_REQUEST,
+ _ => StatusCode::INTERNAL_SERVER_ERROR,
+ };
warn!(
"RPC error ({}): {} ({} ms)",
name,