diff --git a/src/backend/mod.rs b/src/backend/mod.rs index af8ac87..23bc7de 100644 --- a/src/backend/mod.rs +++ b/src/backend/mod.rs @@ -17,6 +17,8 @@ use crate::error; /// It should always read and save in full the data that it is passed. This /// means that a write to the backend followed by a read __must__ return the /// same dataset. +/// +/// **Important**: You can only return custom errors if the `other_errors` feature is enabled pub trait Backend { /// Read the all data from the backend. fn get_data(&mut self) -> error::BackendResult>; diff --git a/src/deser.rs b/src/deser.rs index 1693e63..b67787a 100644 --- a/src/deser.rs +++ b/src/deser.rs @@ -68,6 +68,8 @@ pub use self::bincode::Bincode; /// /// fn main() {} /// ``` +/// +/// **Important**: You can only return custom errors if the `other_errors` feature is enabled pub trait DeSerializer: std::default::Default + Send + Sync + Clone { diff --git a/src/error.rs b/src/error.rs index 358067c..14a172e 100644 --- a/src/error.rs +++ b/src/error.rs @@ -19,8 +19,16 @@ pub enum DeSerError { /// An error occured with Bincode #[error("An error with Bincode occured")] Bincode(#[from] std::boxed::Box), + /// An internal error to Rustbreak occured + #[error("An internal error to rustbreak occured, please report it to the maintainers")] + Internal(String), #[cfg(feature = "other_errors")] - /// An error occured with Bincode + /// A dynamic error occured + /// + /// Most likely the custom `DeSer` implementation has thrown an error, consult its documentation + /// for more information + /// + /// **Important**: This can only be used if the `other_errors` feature is enabled #[error(transparent)] Other(#[from] anyhow::Error), } @@ -38,6 +46,15 @@ pub enum BackendError { /// An internal error to Rustbreak occured #[error("An internal error to rustbreak occured, please report it to the maintainers")] Internal(String), + #[cfg(feature = "other_errors")] + /// A dynamic error occured + /// + /// Most likely the custom `Backend` implementation has thrown an error, consult its documentation + /// for more information + /// + /// **Important**: This can only be used if the `other_errors` feature is enabled + #[error(transparent)] + Other(#[from] anyhow::Error), } /// The different kinds of errors that can be returned