#[cfg(all(feature = "alloc", not(feature = "std")))]
use alloc::string::{String, ToString};
pub type Result<T = (), E = Error> = core::result::Result<T, E>;
#[derive(Debug, thiserror::Error)]
#[non_exhaustive]
pub enum Error {
#[error(transparent)]
Core(#[from] shepherd_core::Error),
#[error(transparent)]
Sqlite(#[from] rusqlite::Error),
#[error("migration {version} failed: {message}")]
Migration { version: i64, message: String },
#[error("registry schema version {found} is ahead of the supported {supported}")]
SchemaAhead { found: i64, supported: i64 },
#[error("registry is read-only")]
ReadOnly,
#[error("unsafe registry path: {0}")]
UnsafePath(String),
#[error("transaction failed ({cause}) and rollback failed ({rollback})")]
TransactionRollback { cause: String, rollback: String },
#[error("{0}")]
Unknown(String),
}
impl Error {
pub fn unknown(message: impl core::fmt::Display) -> Self {
Self::Unknown(message.to_string())
}
}