#[derive(Debug, thiserror::Error)]
#[non_exhaustive]
#[allow(clippy::empty_enum)] pub enum DeSerError {
#[cfg(feature = "yaml_enc")]
#[error("An error with yaml occured")]
Yaml(#[from] serde_yaml::Error),
#[cfg(feature = "ron_enc")]
#[error("An error with Ron occured")]
Ron(#[from] ron::Error),
#[cfg(feature = "bin_enc")]
#[error("An error with Bincode occured")]
Bincode(#[from] std::boxed::Box<bincode::ErrorKind>),
#[error("An internal error to rustbreak occured, please report it to the maintainers")]
Internal(String),
#[cfg(feature = "other_errors")]
#[error(transparent)]
Other(#[from] anyhow::Error),
}
#[derive(Debug, thiserror::Error)]
#[non_exhaustive]
pub enum BackendError {
#[error("An error while persisting the file occured")]
TempFile(#[from] tempfile::PersistError),
#[error("An I/O Error occured")]
Io(#[from] std::io::Error),
#[error("An internal error to rustbreak occured, please report it to the maintainers")]
Internal(String),
#[cfg(feature = "other_errors")]
#[error(transparent)]
Other(#[from] anyhow::Error),
}
#[derive(Debug, thiserror::Error)]
#[non_exhaustive]
pub enum Error {
#[error("Could not deserialize the value")]
DeSerialization(#[from] DeSerError),
#[error("The database has been poisoned")]
Poison,
#[error("The backend has encountered an error")]
Backend(#[from] BackendError),
#[error("The write operation paniced but got caught")]
WritePanic,
}
pub type Result<T> = std::result::Result<T, Error>;
pub type BackendResult<T> = std::result::Result<T, BackendError>;
pub type DeSerResult<T> = std::result::Result<T, DeSerError>;