diff options
author | Alex Auvolat <lx@deuxfleurs.fr> | 2025-01-31 15:39:31 +0100 |
---|---|---|
committer | Alex Auvolat <lx@deuxfleurs.fr> | 2025-02-03 18:54:51 +0100 |
commit | 10bbb26b303e7bd58ca3396009a66b70a1673c0f (patch) | |
tree | 82b718338b1f6e2693d1345ca872bc2fbb652dcb /src/api/admin/error.rs | |
parent | 89ff9f5576f91dc127ba3cc1fae96543e27b9468 (diff) | |
download | garage-10bbb26b303e7bd58ca3396009a66b70a1673c0f.tar.gz garage-10bbb26b303e7bd58ca3396009a66b70a1673c0f.zip |
cli_v2: implement ListWorkers and GetWorkerInfo
Diffstat (limited to 'src/api/admin/error.rs')
-rw-r--r-- | src/api/admin/error.rs | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/src/api/admin/error.rs b/src/api/admin/error.rs index 3712ee7d..354a3bab 100644 --- a/src/api/admin/error.rs +++ b/src/api/admin/error.rs @@ -25,6 +25,10 @@ pub enum Error { #[error(display = "Access key not found: {}", _0)] NoSuchAccessKey(String), + /// The requested worker does not exist + #[error(display = "Worker not found: {}", _0)] + NoSuchWorker(u64), + /// In Import key, the key already exists #[error( display = "Key {} already exists in data store. Even if it is deleted, we can't let you create a new key with the same ID. Sorry.", @@ -53,6 +57,7 @@ impl Error { match self { Error::Common(c) => c.aws_code(), Error::NoSuchAccessKey(_) => "NoSuchAccessKey", + Error::NoSuchWorker(_) => "NoSuchWorker", Error::KeyAlreadyExists(_) => "KeyAlreadyExists", } } @@ -63,7 +68,7 @@ impl ApiError for Error { fn http_status_code(&self) -> StatusCode { match self { Error::Common(c) => c.http_status_code(), - Error::NoSuchAccessKey(_) => StatusCode::NOT_FOUND, + Error::NoSuchAccessKey(_) | Error::NoSuchWorker(_) => StatusCode::NOT_FOUND, Error::KeyAlreadyExists(_) => StatusCode::CONFLICT, } } |