#[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 {
#[error("The actor has halted.")]
Halted,
#[error(
"The actor attempted to access an index ({index}) outside the bounds of the tape (size: {len})."
)]
IndexOutOfBounds { index: usize, len: usize },
#[error(transparent)]
CoreError(#[from] rstm_core::Error),
#[error(transparent)]
StateError(#[from] rstm_state::StateError),
#[error("An unknown error was thrown by an actor: {0}")]
UnknwonError(String),
}
#[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)),
}
}
}