diff options
-rw-r--r-- | doc/book/src/cookbook/real_world.md | 4 | ||||
-rw-r--r-- | src/api/error.rs | 8 | ||||
-rw-r--r-- | src/rpc/rpc_helper.rs | 2 | ||||
-rw-r--r-- | src/util/error.rs | 13 | ||||
-rw-r--r-- | src/web/error.rs | 4 |
5 files changed, 17 insertions, 14 deletions
diff --git a/doc/book/src/cookbook/real_world.md b/doc/book/src/cookbook/real_world.md index 5c773b5c..81921fc2 100644 --- a/doc/book/src/cookbook/real_world.md +++ b/doc/book/src/cookbook/real_world.md @@ -110,7 +110,7 @@ Mercury$ garage node-id 563e1ac825ee3323aa441e72c26d1030d6d4414aeb3dd25287c531e7fc2bc95d@[fc00:1::1]:3901 Venus$ garage node-id -86f0f26ae4afbd59aaf9cfb059eefac844951efd5b8caeec0d53f4ed6c85f332[fc00:1::2]:3901 +86f0f26ae4afbd59aaf9cfb059eefac844951efd5b8caeec0d53f4ed6c85f332@[fc00:1::2]:3901 etc. ``` @@ -120,7 +120,7 @@ You can then add these nodes to the `bootstrap_peers` list of at least one of yo ```toml bootstrap_peers = [ "563e1ac825ee3323aa441e72c26d1030d6d4414aeb3dd25287c531e7fc2bc95d@[fc00:1::1]:3901", - "86f0f26ae4afbd59aaf9cfb059eefac844951efd5b8caeec0d53f4ed6c85f332[fc00:1::2]:3901", + "86f0f26ae4afbd59aaf9cfb059eefac844951efd5b8caeec0d53f4ed6c85f332@[fc00:1::2]:3901", ... ] ``` diff --git a/src/api/error.rs b/src/api/error.rs index 31ba7230..a57f926b 100644 --- a/src/api/error.rs +++ b/src/api/error.rs @@ -83,7 +83,9 @@ impl Error { Error::NotFound => StatusCode::NOT_FOUND, Error::Forbidden(_) => StatusCode::FORBIDDEN, Error::InternalError( - GarageError::Timeout | GarageError::RemoteError(_) | GarageError::Quorum(_, _, _), + GarageError::Timeout + | GarageError::RemoteError(_) + | GarageError::Quorum(_, _, _, _), ) => StatusCode::SERVICE_UNAVAILABLE, Error::InternalError(_) | Error::Hyper(_) | Error::Http(_) => { StatusCode::INTERNAL_SERVER_ERROR @@ -98,7 +100,9 @@ impl Error { Error::Forbidden(_) => "AccessDenied", Error::AuthorizationHeaderMalformed(_) => "AuthorizationHeaderMalformed", Error::InternalError( - GarageError::Timeout | GarageError::RemoteError(_) | GarageError::Quorum(_, _, _), + GarageError::Timeout + | GarageError::RemoteError(_) + | GarageError::Quorum(_, _, _, _), ) => "ServiceUnavailable", Error::InternalError(_) | Error::Hyper(_) | Error::Http(_) => "InternalError", _ => "InvalidRequest", diff --git a/src/rpc/rpc_helper.rs b/src/rpc/rpc_helper.rs index 7413508e..8c7cc681 100644 --- a/src/rpc/rpc_helper.rs +++ b/src/rpc/rpc_helper.rs @@ -203,7 +203,7 @@ impl RpcHelper { Ok(results) } else { let errors = errors.iter().map(|e| format!("{}", e)).collect::<Vec<_>>(); - Err(Error::Quorum(results.len(), to.len(), errors)) + Err(Error::Quorum(quorum, results.len(), to.len(), errors)) } } } diff --git a/src/util/error.rs b/src/util/error.rs index c8d3c680..626958da 100644 --- a/src/util/error.rs +++ b/src/util/error.rs @@ -48,12 +48,13 @@ pub enum Error { Timeout, #[error( - display = "Could not reach quorum. {} of {} request succeeded, others returned errors: {:?}", + display = "Could not reach quorum of {}. {} of {} request succeeded, others returned errors: {:?}", _0, _1, - _2 + _2, + _3 )] - Quorum(usize, usize, Vec<String>), + Quorum(usize, usize, usize, Vec<String>), #[error(display = "Bad RPC: {}", _0)] BadRpc(String), @@ -110,11 +111,7 @@ where fn err_context<C: std::borrow::Borrow<str>>(self, ctx: C) -> Result<T, Error> { match self { Ok(x) => Ok(x), - Err(e) => Err(Error::Message(format!( - "{}\nOriginal error: {}", - ctx.borrow(), - e - ))), + Err(e) => Err(Error::Message(format!("{}\n{}", ctx.borrow(), e))), } } } diff --git a/src/web/error.rs b/src/web/error.rs index 2ed7139f..426155c1 100644 --- a/src/web/error.rs +++ b/src/web/error.rs @@ -39,7 +39,9 @@ impl Error { Error::NotFound => StatusCode::NOT_FOUND, Error::ApiError(e) => e.http_status_code(), Error::InternalError( - GarageError::Timeout | GarageError::RemoteError(_) | GarageError::Quorum(_, _, _), + GarageError::Timeout + | GarageError::RemoteError(_) + | GarageError::Quorum(_, _, _, _), ) => StatusCode::SERVICE_UNAVAILABLE, Error::InternalError(_) => StatusCode::INTERNAL_SERVER_ERROR, _ => StatusCode::BAD_REQUEST, |