use thiserror::Error;
#[derive(Debug, Error, Clone, PartialEq, Eq)]
pub enum ContextError {
#[error("Context {0} does not exist")]
ContextNotFound(crate::contextual::ContextId),
#[error("Context {0} does not have a draft buffer")]
NoDraftBuffer(crate::contextual::ContextId),
#[error("Context {0} does not have a checkpoint stack")]
NoCheckpointStack(crate::contextual::ContextId),
#[error("No checkpoints to restore to for context {0}")]
NoCheckpoints(crate::contextual::ContextId),
#[error("Draft is empty for context {0}")]
EmptyDraft(crate::contextual::ContextId),
#[error("Term is empty")]
EmptyTerm,
#[error("Circular context hierarchy detected: {0} -> {1}")]
CircularHierarchy(crate::contextual::ContextId, crate::contextual::ContextId),
}
pub type Result<T> = std::result::Result<T, ContextError>;