Skip to main content

ErrorHandler

Trait ErrorHandler 

Source
pub trait ErrorHandler<State, Err>: Send + Sync
where State: StateBound,
{ // Required method fn handle( &self, ctx: ErrorContext<State>, error: DyncordError, ) -> DynFuture<'_, ErrorHandlerResult>; }
Expand description

A trait implemented by error handler functions.

Required Methods§

Source

fn handle( &self, ctx: ErrorContext<State>, error: DyncordError, ) -> DynFuture<'_, ErrorHandlerResult>

Runs the error handler together with the passed arguments.

Arguments:

Returns:

  • Ok(()) - If the handling of the error succeeded.
  • Err(ErrorHandlerError) - If an error occurred while handling the error.

Implementors§

Source§

impl<State, Func, Fut, Res> ErrorHandler<State, DyncordError> for Func
where State: StateBound, Func: Fn(ErrorContext<State>, DyncordError) -> Fut + Send + Sync + 'static, Fut: Future<Output = Res> + Send + 'static, Res: IntoErrorHandlerResult,