[−][src]Trait tower_web::error::Catch
Handles an error generated by a resource method.
In the event that an error occurs while processing an HTTP request,
implementations of Catch have the opportunity of gracefully handling the
error. This usually means responding with a friendly error response.
For example, if the error is generated due to no routes matching the HTTP request, then a 404 response should be returned. If a route was matched, but the arguments were not satisfied, then a 400 response should be returned.
Associated Types
type Body: BufStream
The HTTP response body type
type Future: Future<Item = Response<Self::Body>, Error = Error>
Future yielding the HTTP response.
Required Methods
fn catch(&mut self, request: &Request<()>, error: Error) -> Self::Future
Handles an error.
Implementations of Catch generate a friendly HTTP error response based
on the provideed request and error.
See module level documentation for more details.
Implementors
impl Catch for DefaultCatch[src]
impl Catch for DefaultCatchImplements Catch by returning an HTTP response with the appropriate status
code.
The HTTP response will include a basic error message in the response body.
type Body = &'static str
type Future = FutureResult<Response<Self::Body>, Error>
fn catch(&mut self, _request: &Request<()>, error: Error) -> Self::Future[src]
fn catch(&mut self, _request: &Request<()>, error: Error) -> Self::Futureimpl<F, R, Body> Catch for FnCatch<F> where
F: Fn(&Request<()>, Error) -> R,
R: IntoFuture<Item = Response<Body>, Error = Error>,
Body: BufStream, [src]
impl<F, R, Body> Catch for FnCatch<F> where
F: Fn(&Request<()>, Error) -> R,
R: IntoFuture<Item = Response<Body>, Error = Error>,
Body: BufStream,