1pub use crate::binary::errors::{HeaderError, OpenError, UnlockError, WriteError};
4pub use crate::binary::FailedUnlock;
5pub use crate::crypto::KeyGenerationError;
6pub use crate::stream::random::InnerStreamError;
7pub use crate::xml::parse::Error as XmlReadError;
8pub use crate::xml::serialize::Error as XmlWriteError;
9use thiserror::Error;
10
11#[derive(Error, Debug)]
12pub enum Error {
14 #[error("Could not open database: {0}")]
16 Open(#[from] OpenError),
17 #[error("Could not unlock database: {0}")]
19 Unlock(#[from] UnlockError),
20 #[error("Could not write database: {0}")]
22 Write(#[from] WriteError),
23 #[error("Failed to parse database XML: {0}")]
25 XmlRead(#[from] XmlReadError),
26 #[error("Failed to write database XML: {0}")]
28 XmlWrite(#[from] XmlWriteError),
29 #[error("Failed to create encryption keys")]
31 KeyGeneration(#[from] KeyGenerationError),
32}
33
34impl From<FailedUnlock> for Error {
35 fn from(funlock: FailedUnlock) -> Error {
36 Error::Unlock(funlock.1)
37 }
38}