diff options
author | Toby Vincent <tobyv@tobyvin.dev> | 2024-10-01 13:15:24 -0500 |
---|---|---|
committer | Toby Vincent <tobyv@tobyvin.dev> | 2024-10-01 13:15:24 -0500 |
commit | fe16a923190243dfde5db6ceff2ef0bcf9158926 (patch) | |
tree | 9b8b616e1972ca3ef6e28d29c980899af3ddde49 /src/lib.rs | |
parent | e1d9c956beb6921b0d549248bea3a6853fde5f46 (diff) |
feat: simplify service status type
Diffstat (limited to 'src/lib.rs')
-rw-r--r-- | src/lib.rs | 17 |
1 files changed, 10 insertions, 7 deletions
@@ -14,14 +14,17 @@ pub fn router() -> axum::Router<ServiceHandles> { .nest("/sse", sse::router()) } -#[derive(Debug, Clone, Default, PartialEq, Eq, PartialOrd, Ord, Serialize, Deserialize)] +#[derive(Debug, Clone, PartialEq, Eq, PartialOrd, Ord, Serialize, Deserialize)] #[serde(rename_all = "lowercase", tag = "status", content = "output")] pub enum Status { - Pass, - Warn(Option<String>), - Fail(Option<String>), - #[default] - Unknown, + Ok, + Error(Option<String>), +} + +impl Default for Status { + fn default() -> Self { + Status::Error(Some("Unknown".to_string())) + } } impl Status { @@ -36,7 +39,7 @@ impl Status { impl<T: std::error::Error> From<T> for Status { fn from(value: T) -> Self { - Status::Fail(Some(value.to_string())) + Status::Error(Some(value.to_string())) } } |