pub trait ResponseError: Error {
// Provided method
fn error_response(&self) -> Response { ... }
}Expand description
An error that can be converted into an HTTP Response.
Provided Methods§
Sourcefn error_response(&self) -> Response
fn error_response(&self) -> Response
Creates an HTTP response for this error.
The default response has status 500 Internal Server Error, a
text/plain; charset=utf-8 content type, and the error’s
Display representation as its body. Implementations
should override this method when that text is not suitable for clients.
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".
Implementations on Foreign Types§
impl ResponseError for Error
Return InternalServerError for io::Error
Source§impl<T: ResponseError> ResponseError for &T
impl<T: ResponseError> ResponseError for &T
fn error_response(&self) -> Response
Implementors§
impl ResponseError for ntex::web::error::JsonError
InternalServerError for JsonError
impl ResponseError for HandshakeError
impl ResponseError for HttpError
Return InternalServerError for HttpError,
Response generation can return HttpError, so it is internal error