use thiserror::Error;
pub type Result<T> = std::result::Result<T, Error>;
#[derive(Debug, Error)]
#[non_exhaustive]
pub enum Error {
#[error("key not found")]
KeyNotFound,
#[error("incorrect password or key")]
WrongPassword,
#[error("corrupt store: {0}")]
CorruptStore(String),
#[error("unsupported store version {found} (expected {expected})")]
UnsupportedStoreVersion { found: u8, expected: u8 },
#[error("cryptographic operation failed")]
Crypto,
#[error("could not read OS randomness")]
Random,
#[error("secure memory allocation failed")]
SecureAlloc,
#[error("serialization error: {0}")]
Serialization(String),
#[error("io error: {0}")]
Io(#[from] std::io::Error),
#[error("lock unavailable or poisoned")]
Locked,
#[error("store already exists")]
AlreadyExists,
#[error("store is read-only")]
ReadOnly,
#[error("entry expired")]
Expired,
#[error("no path associated with store")]
NoPath,
}