#[cfg(feature = "alloc")]
use alloc::{boxed::Box, string::String};
pub type Result<T> = core::result::Result<T, Error>;
#[derive(Debug, thiserror::Error)]
pub enum Error {
#[cfg(feature = "alloc")]
#[error("[Execution Error] {0}")]
ExecutionError(String),
#[error("The actor is halted and should be terminated.")]
Halted,
#[error("The actor is not ready to process inputs.")]
NotReady,
#[error("The actor has no program loaded.")]
NoProgram,
#[error("The actor has no inputs to process.")]
NoInputs,
#[error("An infinite loop was detected during execution.")]
InfiniteLoop,
#[error("No rule found")]
NoRuleFound,
#[error("No symbol found at position {0}.")]
NoSymbolFound(usize),
#[error(transparent)]
CoreError(#[from] rstm_core::Error),
#[error(transparent)]
ProgramsError(#[from] rstm_programs::Error),
#[error(transparent)]
StateError(#[from] rstm_state::StateError),
}
#[cfg(feature = "alloc")]
impl From<Error> for rstm_core::Error {
fn from(err: Error) -> Self {
match err {
Error::CoreError(e) => e,
e => rstm_core::Error::BoxError(Box::new(e)),
}
}
}