1#[cfg(feature = "alloc")]
7use alloc::{boxed::Box, string::String};
8
9pub type Result<T> = core::result::Result<T, Error>;
11
12#[derive(Debug, thiserror::Error)]
14pub enum Error {
15 #[error("The actor has halted.")]
16 Halted,
17 #[error(
18 "The actor attempted to access an index ({index}) outside the bounds of the tape (size: {len})."
19 )]
20 IndexOutOfBounds { index: usize, len: usize },
21 #[error(transparent)]
22 CoreError(#[from] rstm_core::Error),
23 #[error(transparent)]
24 StateError(#[from] rstm_state::StateError),
25 #[error("An unknown error was thrown by an actor: {0}")]
26 UnknwonError(String),
27}
28
29#[cfg(feature = "alloc")]
30impl From<Error> for rstm_core::Error {
31 fn from(err: Error) -> Self {
32 match err {
33 Error::CoreError(e) => e,
34 e => rstm_core::Error::BoxError(Box::new(e)),
35 }
36 }
37}