pub trait ResponseError: Debug + Display {
// Required methods
fn error_response(&self, req: HttpRequest) -> HttpResponse;
fn description(&self) -> String;
// Provided method
fn status_code(&self) -> StatusCode { ... }
}Expand description
Generate HttpResponse for custom error implementations.
Required Methods§
Sourcefn error_response(&self, req: HttpRequest) -> HttpResponse
fn error_response(&self, req: HttpRequest) -> HttpResponse
Creates a Response from error.
Sourcefn description(&self) -> String
fn description(&self) -> String
Get the underlying error message.
Provided Methods§
Sourcefn status_code(&self) -> StatusCode
fn status_code(&self) -> StatusCode
Returns status code for an error.
Defaults to 500 Internal Server Error.