diff options
author | Alex Auvolat <alex@adnab.me> | 2022-05-13 15:21:32 +0200 |
---|---|---|
committer | Alex Auvolat <alex@adnab.me> | 2022-05-13 15:21:32 +0200 |
commit | 7a5d329e49cc7018cbfa14d37589f51860f66cf0 (patch) | |
tree | 50be9a5eea1b2415bb541aff0c8cb33c0f47b8e4 /src/api/common_error.rs | |
parent | f82b938033f1a01a136315b5f37ecb89b78bca0c (diff) | |
download | garage-7a5d329e49cc7018cbfa14d37589f51860f66cf0.tar.gz garage-7a5d329e49cc7018cbfa14d37589f51860f66cf0.zip |
More error refactoring
Diffstat (limited to 'src/api/common_error.rs')
-rw-r--r-- | src/api/common_error.rs | 5 |
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 |