Trait actix_web::error::ResponseError [−][src]
pub trait ResponseError: Debug + Display {
fn status_code(&self) -> StatusCode { ... }
fn error_response(&self) -> HttpResponseⓘNotable traits for HttpResponse<Body>impl Future for HttpResponse<Body> type Output = Result<Response<Body>, Error>;
{ ... }
}
Expand description
Errors that can generate responses.
Provided methods
fn status_code(&self) -> StatusCode
fn status_code(&self) -> StatusCode
Returns appropriate status code for error.
A 500 Internal Server Error is used by default. If error_response is
also implemented and does not call self.status_code()
, then this will not be used.
fn error_response(&self) -> HttpResponseⓘNotable traits for HttpResponse<Body>impl Future for HttpResponse<Body> type Output = Result<Response<Body>, Error>;
fn error_response(&self) -> HttpResponseⓘNotable traits for HttpResponse<Body>impl Future for HttpResponse<Body> type Output = Result<Response<Body>, Error>;
Notable traits for HttpResponse<Body>
impl Future for HttpResponse<Body> type Output = Result<Response<Body>, Error>;
Creates full response for error.
By default, the generated response uses a 500 Internal Server Error status code, a
Content-Type
of text/plain
, and the body is set to Self
’s Display
impl.
Implementations
Downcasts generic body to a specific type.
Downcasts a generic body to a mutable specific type.
Implementations on Foreign Types
fn error_response(&self) -> HttpResponseⓘNotable traits for HttpResponse<Body>impl Future for HttpResponse<Body> type Output = Result<Response<Body>, Error>;
Notable traits for HttpResponse<Body>
impl Future for HttpResponse<Body> type Output = Result<Response<Body>, Error>;
Implementors
Return BadRequest
for PathError