ResponseError

Trait ResponseError 

Source
pub trait ResponseError:
    Debug
    + Display
    + Send {
    // Provided methods
    fn status_code(&self) -> StatusCode { ... }
    fn error_response(&self) -> HttpResponse<BoxBody> { ... }
}
Expand description

§ResponseError

The ResponseError trait is used to define how an error looks like when sent back to the client

Provided Methods§

Source

fn status_code(&self) -> StatusCode

The status code to be sent back to the client

Source

fn error_response(&self) -> HttpResponse<BoxBody>

Shortcut for creating an HttpResponse

Implementations§

Source§

impl dyn ResponseError + 'static

Source

pub fn downcast_ref<T: ResponseError + 'static>(&self) -> Option<&T>

Downcasts generic body to a specific type.

Source

pub fn downcast_mut<T: ResponseError + 'static>(&mut self) -> Option<&mut T>

Downcasts a generic body to a mutable specific type.

Implementations on Foreign Types§

Source§

impl ResponseError for Infallible

Source§

impl ResponseError for ParseCharError

Source§

impl ResponseError for ParseFloatError

Source§

impl ResponseError for ParseIntError

Source§

impl ResponseError for ParseBoolError

Implementors§