This repository has been archived on 2026-08-20. You can view files and clone it. You cannot open issues or pull requests or push a commit.
Files
el-retired/engram/crates/engram-tx/src/error.rs
T

32 lines
699 B
Rust

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<T> = Result<T, TxError>;