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 #[cfg(feature = "alloc")]
16 #[error("[Execution Error] {0}")]
17 ExecutionError(String),
18 #[error("The actor is halted and should be terminated.")]
19 Halted,
20 #[error("The actor is not ready to process inputs.")]
21 NotReady,
22 #[error("The actor has no program loaded.")]
23 NoProgram,
24 #[error("The actor has no inputs to process.")]
25 NoInputs,
26 #[error("An infinite loop was detected during execution.")]
27 InfiniteLoop,
28 #[error("No rule found")]
29 NoRuleFound,
30 #[error("No symbol found at position {0}.")]
31 NoSymbolFound(usize),
32 #[error(transparent)]
33 CoreError(#[from] rstm_core::Error),
34 #[error(transparent)]
35 ProgramsError(#[from] rstm_programs::Error),
36 #[error(transparent)]
37 StateError(#[from] rstm_state::StateError),
38}
39
40#[cfg(feature = "alloc")]
41impl From<Error> for rstm_core::Error {
42 fn from(err: Error) -> Self {
43 match err {
44 Error::CoreError(e) => e,
45 e => rstm_core::Error::BoxError(Box::new(e)),
46 }
47 }
48}