diff options
| author | Naz <ndpm13@ch-naseem.com> | 2025-07-31 14:50:21 +0100 |
|---|---|---|
| committer | Naz <ndpm13@ch-naseem.com> | 2025-07-31 14:50:21 +0100 |
| commit | 61b6008db55f8aa6d9cc8d8998c3e28916e144cc (patch) | |
| tree | 64303da75bfb86162873377eb520b2513c72d7df | |
| parent | 6b3f5d37fbce2e880a454e66d8fbd78269f1c867 (diff) | |
✨feat: add an error module
| -rw-r--r-- | Cargo.lock | 25 | ||||
| -rw-r--r-- | Cargo.toml | 1 | ||||
| -rw-r--r-- | src/error.rs | 21 | ||||
| -rw-r--r-- | src/lib.rs | 2 |
4 files changed, 47 insertions, 2 deletions
@@ -209,6 +209,26 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "773648b94d0e5d620f64f280777445740e61fe701025087ec8b57f45c791888b" [[package]] +name = "derive_more" +version = "2.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "093242cf7570c207c83073cf82f79706fe7b8317e98620a47d5be7c3d8497678" +dependencies = [ + "derive_more-impl", +] + +[[package]] +name = "derive_more-impl" +version = "2.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bda628edc44c4bb645fbe0f758797143e4e07926f7ebf4e9bdfbd3d2ce621df3" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + +[[package]] name = "displaydoc" version = "0.2.5" source = "registry+https://github.com/rust-lang/crates.io-index" @@ -247,7 +267,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "778e2ac28f6c47af28e4907f13ffd1e1ddbd400980a9abd7c8df189bf578a5ad" dependencies = [ "libc", - "windows-sys 0.59.0", + "windows-sys 0.60.2", ] [[package]] @@ -1023,7 +1043,7 @@ dependencies = [ "errno", "libc", "linux-raw-sys", - "windows-sys 0.59.0", + "windows-sys 0.60.2", ] [[package]] @@ -1838,6 +1858,7 @@ name = "zap-rs" version = "0.1.0" dependencies = [ "clap", + "derive_more", "futures-util", "indicatif", "reqwest", @@ -5,6 +5,7 @@ edition = "2024" [dependencies] clap = { version = "4.5.41", features = ["derive"] } +derive_more = { version = "2.0.1", features = ["from"] } futures-util = "0.3.31" indicatif = { version = "0.18.0", features = ["improved_unicode"] } reqwest = { version = "0.12.22", features = ["blocking", "json", "stream"] } diff --git a/src/error.rs b/src/error.rs new file mode 100644 index 0000000..0183e38 --- /dev/null +++ b/src/error.rs @@ -0,0 +1,21 @@ +use derive_more::From; + +pub type Result<T> = core::result::Result<T, Error>; + +#[derive(Debug, From)] +pub enum Error { + InvalidPath, + NotFound(String), + + #[from] + Io(std::io::Error), + + #[from] + Json(serde_json::Error), + + #[from] + Http(reqwest::Error), + + #[from] + EnvVar(std::env::VarError), +} @@ -6,6 +6,7 @@ mod manager; mod paths; mod symlink; mod tui; +mod error; pub use crate::appimage::*; pub use crate::args::*; @@ -15,3 +16,4 @@ pub use crate::manager::*; pub use crate::paths::*; pub use crate::symlink::*; pub use crate::tui::*; +pub use crate::error::*; |
