diff options
author | Quentin <quentin@deuxfleurs.fr> | 2020-11-11 11:26:51 +0100 |
---|---|---|
committer | Quentin <quentin@deuxfleurs.fr> | 2020-11-11 11:26:51 +0100 |
commit | e31aa0f7dfb4c8f014ce65cdf749141d2a9fec21 (patch) | |
tree | 286920418940dc40b679cdf71627d7fe276f0fc1 /src/rpc | |
parent | f01006a1f954cecb23085ceac5ec28f165a6f0d7 (diff) | |
parent | 045009da9b7ac4198574bd5aa256c11cfe4ae469 (diff) | |
download | garage-e31aa0f7dfb4c8f014ce65cdf749141d2a9fec21.tar.gz garage-e31aa0f7dfb4c8f014ce65cdf749141d2a9fec21.zip |
Merge branch 'master' into feature/refactor-s3
Diffstat (limited to 'src/rpc')
-rw-r--r-- | src/rpc/membership.rs | 2 | ||||
-rw-r--r-- | src/rpc/rpc_server.rs | 5 |
2 files changed, 5 insertions, 2 deletions
diff --git a/src/rpc/membership.rs b/src/rpc/membership.rs index d19c1eb7..697cddd0 100644 --- a/src/rpc/membership.rs +++ b/src/rpc/membership.rs @@ -373,7 +373,7 @@ impl System { Message::AdvertiseNodesUp(adv) => self2.handle_advertise_nodes_up(&adv).await, Message::AdvertiseConfig(adv) => self2.handle_advertise_config(&adv).await, - _ => Err(Error::BadRequest(format!("Unexpected RPC message"))), + _ => Err(Error::BadRPC(format!("Unexpected RPC message"))), } } }); 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, |