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§
Sourcefn status_code(&self) -> StatusCode
fn status_code(&self) -> StatusCode
The status code to be sent back to the client
Sourcefn error_response(&self) -> HttpResponse<BoxBody>
fn error_response(&self) -> HttpResponse<BoxBody>
Shortcut for creating an HttpResponse
Implementations§
Source§impl dyn ResponseError + 'static
impl dyn ResponseError + 'static
Sourcepub fn downcast_ref<T: ResponseError + 'static>(&self) -> Option<&T>
pub fn downcast_ref<T: ResponseError + 'static>(&self) -> Option<&T>
Downcasts generic body to a specific type.
Sourcepub fn downcast_mut<T: ResponseError + 'static>(&mut self) -> Option<&mut T>
pub fn downcast_mut<T: ResponseError + 'static>(&mut self) -> Option<&mut T>
Downcasts a generic body to a mutable specific type.