rstm_state/error.rs
1/*
2 Appellation: error <module>
3 Contrib: FL03 <jo3mccain@icloud.com>
4*/
5//! This module defines the custom error type for handling various state-related errors.
6#[cfg(feature = "alloc")]
7use alloc::string::String;
8
9/// A type alias for a [`Result`](core::result::Result) that uses the custom [`Error`] type
10pub type Result<T> = core::result::Result<T, StateError>;
11
12/// the various errors that can occur in the state module
13#[derive(Debug, thiserror::Error)]
14pub enum StateError {
15 #[error("Failed to downcast state")]
16 DowncastError,
17 #[cfg(feature = "alloc")]
18 #[error("Invalid State: {0}")]
19 InvalidState(String),
20 #[error("State Not Found")]
21 StateNotFound,
22}