#[non_exhaustive]pub enum HexeractError {
HandlerNotFound {
command_type: &'static str,
},
HandlerFailed {
source: Box<dyn Error + Send + Sync>,
},
#[non_exhaustive] Timeout {
type_name: &'static str,
duration: Duration,
},
#[non_exhaustive] DowncastFailed {
expected: &'static str,
},
Dispatch(String),
}Expand description
Top-level error type for the Hexeract framework.
This enum is marked #[non_exhaustive] so that new variants can be added
in minor versions without breaking downstream match arms.
Variants (Non-exhaustive)§
This enum is marked as non-exhaustive
HandlerNotFound
No handler was registered for the given command or query type.
Fields
HandlerFailed
A handler returned an error. The original error is preserved as source.
#[non_exhaustive]Timeout
A dispatch exceeded its configured deadline.
Fields
This variant is marked as non-exhaustive
#[non_exhaustive]DowncastFailed
A dispatch produced a value that could not be downcast to the expected output type.
This indicates a short-circuiting Middleware
boxed a value whose type is not the message’s Output. A correct
short-circuit must box exactly the dispatched message’s output type.
Fields
This variant is marked as non-exhaustive
Dispatch(String)
A generic dispatch-level error with a human-readable message.
Implementations§
Source§impl HexeractError
impl HexeractError
Sourcepub fn handler_failed(source: impl Error + Send + Sync + 'static) -> Self
pub fn handler_failed(source: impl Error + Send + Sync + 'static) -> Self
Wraps any Send + Sync error as a HexeractError::HandlerFailed.
Sourcepub fn timeout(type_name: &'static str, duration: Duration) -> Self
pub fn timeout(type_name: &'static str, duration: Duration) -> Self
Builds a HexeractError::Timeout from the dispatched message type
name and the timeout that was exceeded. This is the only way to
construct the variant from outside this crate, since it is marked
#[non_exhaustive].
Sourcepub fn downcast_failed(expected: &'static str) -> Self
pub fn downcast_failed(expected: &'static str) -> Self
Builds a HexeractError::DowncastFailed from the fully-qualified name
of the output type the dispatch expected. This is the only way to
construct the variant from outside this crate, since it is marked
#[non_exhaustive].
Trait Implementations§
Source§impl Debug for HexeractError
impl Debug for HexeractError
Source§impl Display for HexeractError
impl Display for HexeractError
Source§impl Error for HexeractError
impl Error for HexeractError
Source§fn source(&self) -> Option<&(dyn Error + 'static)>
fn source(&self) -> Option<&(dyn Error + 'static)>
1.0.0 · Source§fn description(&self) -> &str
fn description(&self) -> &str
use the Display impl or to_string()