forked from Deuxfleurs/garage
Improve clarity
This commit is contained in:
parent
bff5333c62
commit
dbe457d3fa
5 changed files with 17 additions and 14 deletions
|
@ -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",
|
||||
...
|
||||
]
|
||||
```
|
||||
|
|
|
@ -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",
|
||||
|
|
|
@ -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))
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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))),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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,
|
||||
|
|
Loading…
Reference in a new issue