IntoErrorResponse

Trait IntoErrorResponse 

Source
pub trait IntoErrorResponse<T> {
    // Required methods
    fn internal_server_error(self) -> Result<T, ErrorResponse>;
    fn not_found(self) -> Result<T, ErrorResponse>;
    fn unauthenticated(self) -> Result<T, ErrorResponse>;
    fn unprocessable_entity(self) -> Result<T, ErrorResponse>;
}
Expand description

Trait for providing convenience functions to mark an error as a given type.

Required Methods§

Source

fn internal_server_error(self) -> Result<T, ErrorResponse>

Mark the error as an internal server error.

Source

fn not_found(self) -> Result<T, ErrorResponse>

Mark the error as caused because the resource could not be found.

Source

fn unauthenticated(self) -> Result<T, ErrorResponse>

Mark the error as caused because the request was unauthenticated.

Source

fn unprocessable_entity(self) -> Result<T, ErrorResponse>

Mark the error as caused by something that couldn’t be processed.

Implementations on Foreign Types§

Source§

impl<T> IntoErrorResponse<T> for Option<T>

Source§

impl<T, E: Error + 'static> IntoErrorResponse<T> for Result<T, E>

Implementors§