aboutsummaryrefslogtreecommitdiff
path: root/src/api/error.rs
diff options
context:
space:
mode:
authorAlex Auvolat <alex@adnab.me>2022-05-13 14:30:30 +0200
committerAlex Auvolat <alex@adnab.me>2022-05-13 14:30:30 +0200
commitc0fb9fd0fe553e5eda39dcb1a09f059bcd631b6c (patch)
tree4d73c67a540e032190543fc319fad12c409e1e16 /src/api/error.rs
parent983037d965fdcdf089b09fa90fac31501defae9e (diff)
downloadgarage-c0fb9fd0fe553e5eda39dcb1a09f059bcd631b6c.tar.gz
garage-c0fb9fd0fe553e5eda39dcb1a09f059bcd631b6c.zip
Common error type and admin error type that uses it
Diffstat (limited to 'src/api/error.rs')
-rw-r--r--src/api/error.rs4
1 files changed, 4 insertions, 0 deletions
diff --git a/src/api/error.rs b/src/api/error.rs
index 5c33d763..90bfccef 100644
--- a/src/api/error.rs
+++ b/src/api/error.rs
@@ -166,6 +166,10 @@ impl Error {
_ => "InvalidRequest",
}
}
+
+ pub fn bad_request<M: ToString>(msg: M) -> Self {
+ Self::BadRequest(msg.to_string())
+ }
}
impl ApiError for Error {