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§
Sourcefn internal_server_error(self) -> Result<T, ErrorResponse>
fn internal_server_error(self) -> Result<T, ErrorResponse>
Mark the error as an internal server error.
Sourcefn not_found(self) -> Result<T, ErrorResponse>
fn not_found(self) -> Result<T, ErrorResponse>
Mark the error as caused because the resource could not be found.
Sourcefn unauthenticated(self) -> Result<T, ErrorResponse>
fn unauthenticated(self) -> Result<T, ErrorResponse>
Mark the error as caused because the request was unauthenticated.
Sourcefn unprocessable_entity(self) -> Result<T, ErrorResponse>
fn unprocessable_entity(self) -> Result<T, ErrorResponse>
Mark the error as caused by something that couldn’t be processed.