summaryrefslogtreecommitdiffstats
path: root/src/lib.rs
diff options
context:
space:
mode:
authorToby Vincent <tobyv@tobyvin.dev>2024-10-01 13:15:24 -0500
committerToby Vincent <tobyv@tobyvin.dev>2024-10-01 13:15:24 -0500
commitfe16a923190243dfde5db6ceff2ef0bcf9158926 (patch)
tree9b8b616e1972ca3ef6e28d29c980899af3ddde49 /src/lib.rs
parente1d9c956beb6921b0d549248bea3a6853fde5f46 (diff)
feat: simplify service status type
Diffstat (limited to 'src/lib.rs')
-rw-r--r--src/lib.rs17
1 files changed, 10 insertions, 7 deletions
diff --git a/src/lib.rs b/src/lib.rs
index d24f635..dc0efe7 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -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()))
}
}