use thiserror::Error;
pub type RuntimeResult<T> = Result<T, RuntimeError>;
#[derive(Debug, Error)]
pub enum RuntimeError {
#[error("io error: {0}")]
Io(#[from] std::io::Error),
#[error("database error: {0}")]
Database(#[from] sea_orm::DbErr),
#[error("json error: {0}")]
Json(#[from] serde_json::Error),
#[error("system error: {0}")]
Nix(#[from] nix::errno::Errno),
#[error("{0}")]
Custom(String),
}
impl microsandbox_db::retry::IsSqliteBusy for RuntimeError {
fn is_sqlite_busy(&self) -> bool {
matches!(self, RuntimeError::Database(db_err) if microsandbox_db::retry::is_sqlite_busy(db_err))
}
}