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;