use thiserror::Error; use uuid::Uuid; #[derive(Debug, Error)] pub enum TxError { #[error("Command not found: {0}")] NotFound(Uuid), #[error("Command already applied (idempotency key: {0})")] AlreadyApplied(String), #[error("Cannot roll back a command in status {0:?}")] InvalidStatus(String), #[error("Conflict: {0}")] Conflict(String), #[error("JSON error: {0}")] Json(#[from] serde_json::Error), #[error("Storage error: {0}")] Storage(#[from] sled::Error), #[error("Engram error: {0}")] Engram(#[from] engram_core::EngramError), #[error("Invalid command: {0}")] Invalid(String), } pub type TxResult = Result;