aboutsummaryrefslogtreecommitdiff
path: root/src/api/common_error.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/api/common_error.rs')
-rw-r--r--src/api/common_error.rs5
1 files changed, 5 insertions, 0 deletions
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<M: ToString>(msg: M) -> Self {
+ CommonError::BadRequest(msg.to_string())
+ }
}
/// Trait to map error to the Bad Request error code