use thiserror::Error;
#[derive(Debug, Error)]
pub enum ClawError {
#[error("database error: {0}")]
Database(#[from] sqlx::Error),
#[error("migration error: {0}")]
Migration(String),
#[error("configuration error: {0}")]
Config(String),
#[error("{entity} with id '{id}' not found")]
NotFound {
entity: String,
id: String,
},
#[error("{entity} with id '{id}' already exists")]
Conflict {
entity: String,
id: String,
},
#[error("serialization error: {0}")]
Serialization(#[from] serde_json::Error),
#[error("snapshot error: {0}")]
Snapshot(String),
#[error("snapshot corrupt: {0}")]
SnapshotCorrupt(String),
#[error("transaction error: {0}")]
Transaction(String),
#[error("cache error: {0}")]
Cache(String),
#[error("invalid input: {0}")]
InvalidInput(String),
#[error("I/O error: {0}")]
IoError(#[from] std::io::Error),
#[error("store error: {0}")]
Store(String),
#[error("index error: {0}")]
Index(String),
#[error("internal error: {0}")]
Internal(String),
}
pub type ClawResult<T> = Result<T, ClawError>;