worker_route::http

Trait ResponseError

Source
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§

Source

fn error_response(&self, req: HttpRequest) -> HttpResponse

Creates a Response from error.

Source

fn description(&self) -> String

Get the underlying error message.

Provided Methods§

Source

fn status_code(&self) -> StatusCode

Returns status code for an error.

Defaults to 500 Internal Server Error.

Implementations on Foreign Types§

Source§

impl ResponseError for Error

Source§

impl ResponseError for Error

Source§

impl ResponseError for Error

Implementors§