use thiserror::Error;
pub type Result<T> = std::result::Result<T, PersistenceError>;
#[derive(Debug, Error)]
pub enum PersistenceError {
#[error("failed to connect to storage: {0}")]
ConnectionFailed(String),
#[error("failed to read checkpoint: {0}")]
ReadFailed(String),
#[error("failed to write checkpoint: {0}")]
WriteFailed(String),
#[error("serialization failed: {0}")]
SerializationFailed(#[from] serde_json::Error),
#[error("failed to delete checkpoint: {0}")]
DeleteFailed(String),
#[error("I/O error: {0}")]
IoError(#[from] std::io::Error),
#[cfg(feature = "sqlite")]
#[error("SQLite error: {0}")]
SqliteError(#[from] rusqlite::Error),
#[cfg(feature = "postgres")]
#[error("PostgreSQL error: {0}")]
PostgresError(#[from] sqlx::Error),
}