pub enum TaskError<E> {
Fsm(E),
Join(JoinError),
}Expand description
Error type returned by the FSM background task.
This enum distinguishes between logical errors returned by your FSM handlers and runtime failures of the Tokio task itself (for example, panics or task aborts).
§Type Parameters
E: The logical error type defined in yourimplblock viatype Error = ...;.
§Examples
ⓘ
use tokio_fsm::TaskError;
// Example of a match against a task's result
match task.await {
Ok(final_context) => println!("FSM finished normally."),
Err(TaskError::Fsm(e)) => println!("FSM aborted with a logical error: {}", e),
Err(TaskError::Join(e)) => println!("Tokio task failed (e.g. panicked): {}", e),
}Variants§
Fsm(E)
The FSM handler returned a logical error, triggering a shutdown.
This variant is used when your FSM handler returns Result::Err(...).
Join(JoinError)
The background task failed due to a panic or explicit task abort.
This wraps a tokio::task::JoinError.
Trait Implementations§
Source§impl<E> Error for TaskError<E>
impl<E> Error for TaskError<E>
Source§fn source(&self) -> Option<&(dyn Error + 'static)>
fn source(&self) -> Option<&(dyn Error + 'static)>
Returns the lower-level source of this error, if any. Read more
1.0.0 · Source§fn description(&self) -> &str
fn description(&self) -> &str
👎Deprecated since 1.42.0:
use the Display impl or to_string()
Auto Trait Implementations§
impl<E> !RefUnwindSafe for TaskError<E>
impl<E> !UnwindSafe for TaskError<E>
impl<E> Freeze for TaskError<E>where
E: Freeze,
impl<E> Send for TaskError<E>where
E: Send,
impl<E> Sync for TaskError<E>where
E: Sync,
impl<E> Unpin for TaskError<E>where
E: Unpin,
impl<E> UnsafeUnpin for TaskError<E>where
E: UnsafeUnpin,
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more