From c2d323c23d87047e91eaf1fa09ed01262a93fdde Mon Sep 17 00:00:00 2001 From: lazyfuhrer Date: Wed, 1 May 2024 05:00:53 +0530 Subject: [PATCH] feat: added thiserror crate in floresta-cli --- Cargo.lock | 9 +++++---- crates/floresta-cli/Cargo.toml | 1 + crates/floresta-cli/src/error.rs | 8 ++++++++ 3 files changed, 14 insertions(+), 4 deletions(-) create mode 100644 crates/floresta-cli/src/error.rs diff --git a/Cargo.lock b/Cargo.lock index 1764f908..4596cef7 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -932,6 +932,7 @@ dependencies = [ "serde", "serde_json", "tempfile", + "thiserror", ] [[package]] @@ -2762,18 +2763,18 @@ dependencies = [ [[package]] name = "thiserror" -version = "1.0.58" +version = "1.0.59" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "03468839009160513471e86a034bb2c5c0e4baae3b43f79ffc55c4a5427b3297" +checksum = "f0126ad08bff79f29fc3ae6a55cc72352056dfff61e3ff8bb7129476d44b23aa" dependencies = [ "thiserror-impl", ] [[package]] name = "thiserror-impl" -version = "1.0.58" +version = "1.0.59" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c61f3ba182994efc43764a46c018c347bc492c79f024e705f46567b418f6d4f7" +checksum = "d1cd413b5d558b4c5bf3680e324a6fa5014e7b7c067a51e69dbdf47eb7148b66" dependencies = [ "proc-macro2", "quote", diff --git a/crates/floresta-cli/Cargo.toml b/crates/floresta-cli/Cargo.toml index 6a4c552f..c0aef06a 100644 --- a/crates/floresta-cli/Cargo.toml +++ b/crates/floresta-cli/Cargo.toml @@ -21,6 +21,7 @@ serde = { version = "1.0", features = ["derive"] } serde_json = "1.0" anyhow = "1.0" reqwest = { version = "0.11.23", optional = true, features = ["blocking"] } +thiserror = "1.0.59" [features] default = ["with-reqwest"] diff --git a/crates/floresta-cli/src/error.rs b/crates/floresta-cli/src/error.rs new file mode 100644 index 00000000..54c8d156 --- /dev/null +++ b/crates/floresta-cli/src/error.rs @@ -0,0 +1,8 @@ +use thiserror::Error as ThisError; +use std::error::Error; + +#[derive(Debug, ThisError)] +pub enum FlorestaError { + #[error("Unexpected error: {0}")] + Unexpected(Box), +} \ No newline at end of file