pub trait ExceptionHandler: Send + Sync {
// Required method
fn handle_exception<'life0, 'life1, 'async_trait>(
&'life0 self,
request: &'life1 Request,
error: DispatchError,
) -> Pin<Box<dyn Future<Output = Response> + Send + 'async_trait>>
where 'life0: 'async_trait,
'life1: 'async_trait,
Self: 'async_trait;
}Available on
native and crate feature dispatch only.Expand description
A compatibility hook for handling the dispatch-specific error categories.
This trait preserves the public contract exposed by reinhardt-dispatch
before the framework-wide HTTP exception hook was introduced. New server,
router, and middleware APIs use reinhardt_http::ExceptionHandler; pass a
legacy implementation through adapt_exception_handler when it must be
installed through one of those APIs.
Required Methods§
Sourcefn handle_exception<'life0, 'life1, 'async_trait>(
&'life0 self,
request: &'life1 Request,
error: DispatchError,
) -> Pin<Box<dyn Future<Output = Response> + Send + 'async_trait>>where
'life0: 'async_trait,
'life1: 'async_trait,
Self: 'async_trait,
fn handle_exception<'life0, 'life1, 'async_trait>(
&'life0 self,
request: &'life1 Request,
error: DispatchError,
) -> Pin<Box<dyn Future<Output = Response> + Send + 'async_trait>>where
'life0: 'async_trait,
'life1: 'async_trait,
Self: 'async_trait,
Handle a dispatch error and convert it to a response.
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".