use sim_lib_journal::JournalError;
use thiserror::Error;
#[derive(Debug, Error)]
pub enum OperationError {
#[error("operation name is empty")]
EmptyOperation,
#[error("noncanonical {0}")]
NonCanonical(&'static str),
#[error("contradictory intent under one operation id")]
ContradictoryIntent,
#[error("operation grant does not match intent")]
GrantMismatch,
#[error("operation attempt does not match intent")]
AttemptMismatch,
#[error("durable operation contains duplicate intent")]
DuplicateIntent,
#[error("invalid durable operation transition: {0}")]
InvalidTransition(&'static str),
#[error("operation service must be explicitly resumed")]
NotResumed,
#[error("operation journal sequence is exhausted")]
SequenceExhausted,
#[error(transparent)]
Journal(#[from] JournalError),
}