use heed::Error as HeedError;
use rkyv::rancor::Error as RkyvError;
#[derive(Debug, thiserror::Error)]
pub enum Error {
#[error(transparent)]
Heed(#[from] HeedError),
#[error(transparent)]
Rkyv(#[from] RkyvError),
#[error("Database not found: {0}")]
DatabaseNotFound(String),
#[error("Stream already exists: {0}")]
StreamAlreadyExists(String),
#[error("Stream not found: {0}")]
StreamNotFound(String),
#[error("Event not found at global sequence {0}")]
EventNotFound(u64),
#[cfg(feature = "log")]
#[error(transparent)]
Log(#[from] LogError),
}
#[cfg(feature = "log")]
#[derive(Debug, thiserror::Error)]
pub enum LogError {
#[error(transparent)]
SetLogger(#[from] tracing_subscriber::util::TryInitError),
}
pub type Result<T> = std::result::Result<T, Error>;
#[cfg(feature = "log")]
pub type LogResult<T> = std::result::Result<T, LogError>;