Trait actix_web::error::ResponseError

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

Errors that can generate responses.

Provided Methods§

source

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.

source

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

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§

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 HandshakeError

source§

impl ResponseError for ProtocolError

source§

impl ResponseError for Error

source§

impl ResponseError for Box<dyn StdError + 'static>

source§

impl ResponseError for Utf8Error

source§

impl ResponseError for Error

source§

impl ResponseError for Error

Available on crate feature openssl only.
source§

impl ResponseError for Error

source§

impl ResponseError for Error

Implementors§