pub trait ErrorHandler<State, Err>: Send + Syncwhere
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§
Sourcefn handle(
&self,
ctx: ErrorContext<State>,
error: DyncordError,
) -> DynFuture<'_, ErrorHandlerResult>
fn handle( &self, ctx: ErrorContext<State>, error: DyncordError, ) -> DynFuture<'_, ErrorHandlerResult>
Runs the error handler together with the passed arguments.
Arguments:
ctx- TheErrorContext. CheckErrorContext::originalfor the original context type.error- The error that occurred.
Returns:
Ok(())- If the handling of the error succeeded.Err(ErrorHandlerError)- If an error occurred while handling the error.