diff options
author | Alex Auvolat <alex@adnab.me> | 2021-12-22 18:50:08 +0100 |
---|---|---|
committer | Alex Auvolat <alex@adnab.me> | 2022-01-04 12:47:28 +0100 |
commit | d8ab5bdc3e20759e5ba8a6844393757da3539372 (patch) | |
tree | 7fc9abc578bb4185691313889ed94aedca09dbc4 /src/util/error.rs | |
parent | c7d5c732442c5802058b46205d450d4620772b7b (diff) | |
download | garage-d8ab5bdc3e20759e5ba8a6844393757da3539372.tar.gz garage-d8ab5bdc3e20759e5ba8a6844393757da3539372.zip |
New buckets for 0.6.0: fix model and migration
Diffstat (limited to 'src/util/error.rs')
-rw-r--r-- | src/util/error.rs | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/src/util/error.rs b/src/util/error.rs index 08cf1302..ef5a76f2 100644 --- a/src/util/error.rs +++ b/src/util/error.rs @@ -119,17 +119,17 @@ where } } -/// Trait to map error to the Bad Request error code +/// Trait to map any error type to Error::Message pub trait OkOrMessage { - type S2; - fn ok_or_message<M: Into<String>>(self, message: M) -> Self::S2; + type S; + fn ok_or_message<M: Into<String>>(self, message: M) -> Result<Self::S, Error>; } impl<T, E> OkOrMessage for Result<T, E> where E: std::fmt::Display, { - type S2 = Result<T, Error>; + type S = T; fn ok_or_message<M: Into<String>>(self, message: M) -> Result<T, Error> { match self { Ok(x) => Ok(x), @@ -139,7 +139,7 @@ where } impl<T> OkOrMessage for Option<T> { - type S2 = Result<T, Error>; + type S = T; fn ok_or_message<M: Into<String>>(self, message: M) -> Result<T, Error> { match self { Some(x) => Ok(x), |