From 7a5d329e49cc7018cbfa14d37589f51860f66cf0 Mon Sep 17 00:00:00 2001 From: Alex Auvolat Date: Fri, 13 May 2022 15:21:32 +0200 Subject: More error refactoring --- src/api/common_error.rs | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'src/api/common_error.rs') diff --git a/src/api/common_error.rs b/src/api/common_error.rs index eca27e6b..48106e03 100644 --- a/src/api/common_error.rs +++ b/src/api/common_error.rs @@ -38,6 +38,11 @@ impl CommonError { CommonError::BadRequest(_) => StatusCode::BAD_REQUEST, } } + + + pub fn bad_request(msg: M) -> Self { + CommonError::BadRequest(msg.to_string()) + } } /// Trait to map error to the Bad Request error code -- cgit v1.2.3