Trait HttpError

Source
pub trait HttpError:
    Error
    + Send
    + Sync
    + 'static {
    // Provided methods
    fn log(&self) { ... }
    fn status(&self) -> StatusCode { ... }
    fn reason(&self) -> String { ... }
    fn type_name(&self) -> &str { ... }
}
Expand description

This trait should be implemented by error types that can be used as HTTP error responses

Provided Methods§

Source

fn log(&self)

Handles logging the error when its translated into an HTTP error response

Default implementation logs both the Display and Debug variants of the error

Source

fn status(&self) -> StatusCode

Handles determining the HTTP status code that should be used for the HTTP response

Defaults to StatusCode::INTERNAL_SERVER_ERROR

Source

fn reason(&self) -> String

Handles creating the error response “reason” text that is included in the error

Source

fn type_name(&self) -> &str

Provides the full type name for the actual error type thats been erased by dynamic typing (For better error source clarity) used by the Debug implementation of DynHttpError

Implementors§