use crate::{EpochID, Slice, Term};
use smartstring::alias::String;
use thiserror::Error;
#[derive(Debug, Clone, Error)]
pub enum TermError {
#[error("Invalid term {0:?}")]
InvalidTerm(Term),
#[error("Epoch overflow")]
LiveEpochsExceeded,
#[error("Invalid epoch {0:?}")]
InvalidEpoch(EpochID),
#[error("Missing functor")]
MissingFunctor,
#[error("Invalid functor {0:?}")]
InvalidFunctor(Term),
#[error("Type mismatch: expected {expected}, found {found}")]
UnexpectedKind {
expected: &'static str,
found: &'static str,
},
#[error("Arity mismatch: expected {expected}, found {found}")]
UnexpectedArity { expected: usize, found: usize },
#[error("Unexpected name in {0:?}")]
UnexpectedName(Term),
#[error("invalid fixity: {0}")]
InvalidFixity(String),
#[error("invalid associativity: {0}")]
InvalidAssoc(String),
#[error("operdef error: {0}")]
OperDef(String),
#[error("encoding error: {0}")]
Encoding(String),
}
#[derive(Debug, Clone, Error)]
pub(crate) enum InternalTermError {
#[error("invalid arena epoch: {0:?}")]
InvalidEpoch(EpochID),
#[error("invalid term slice: {0:?}")]
InvalidSlice(Slice),
}