From 17c1b4ff6df59ea13f7a2189bd614873c173e669 Mon Sep 17 00:00:00 2001 From: Paul Campbell Date: Sat, 9 Nov 2024 07:52:42 +0000 Subject: [PATCH] feat: add kxio::Result; --- src/lib.rs | 3 +++ src/result.rs | 14 ++++++++++++++ 2 files changed, 17 insertions(+) create mode 100644 src/result.rs diff --git a/src/lib.rs b/src/lib.rs index 1d24bc8..fd7df0d 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -1,3 +1,6 @@ // pub mod fs; pub mod net; +mod result; + +pub use result::{Error, Result}; diff --git a/src/result.rs b/src/result.rs new file mode 100644 index 0000000..40230b0 --- /dev/null +++ b/src/result.rs @@ -0,0 +1,14 @@ +// +use derive_more::{Display, From}; + +/// Represents a error accessing the file system or network. +#[derive(Debug, From, Display)] +pub enum Error { + Fs(#[from] crate::fs::Error), + Net(#[from] crate::net::Error), + Reqwest(#[from] reqwest::Error), +} +impl std::error::Error for Error {} + +/// Represents a success or a failure using `fs` or `net`. +pub type Result = core::result::Result;