stak_device/primitive_set/
error.rsuse core::{
error,
fmt::{self, Display, Formatter},
};
#[derive(Clone, Debug, Eq, PartialEq)]
pub enum PrimitiveError {
ReadInput,
Vm(stak_vm::Error),
WriteError,
WriteOutput,
}
impl error::Error for PrimitiveError {}
impl Display for PrimitiveError {
fn fmt(&self, formatter: &mut Formatter) -> fmt::Result {
match self {
Self::ReadInput => write!(formatter, "failed to read input"),
Self::Vm(error) => write!(formatter, "{error}"),
Self::WriteError => write!(formatter, "failed to write error"),
Self::WriteOutput => write!(formatter, "failed to write output"),
}
}
}
impl From<stak_vm::Error> for PrimitiveError {
fn from(error: stak_vm::Error) -> Self {
Self::Vm(error)
}
}