diff options
| author | David Lönnhager <david.l@mullvad.net> | 2023-10-23 19:59:08 +0200 |
|---|---|---|
| committer | David Lönnhager <david.l@mullvad.net> | 2023-10-24 12:41:10 +0200 |
| commit | fcb7ec89b43b52576cd25474fbc0fd82cd2262c4 (patch) | |
| tree | f6124d803c7eb74802bb6b477910a2d0638a4f1a /mullvad-api | |
| parent | a8bd2862bd9c6b228bad8a04f2d30ae38d3dad9d (diff) | |
| download | mullvadvpn-fcb7ec89b43b52576cd25474fbc0fd82cd2262c4.tar.xz mullvadvpn-fcb7ec89b43b52576cd25474fbc0fd82cd2262c4.zip | |
Remove 'ResponseFailure' device error variant
Diffstat (limited to 'mullvad-api')
| -rw-r--r-- | mullvad-api/src/rest.rs | 26 |
1 files changed, 11 insertions, 15 deletions
diff --git a/mullvad-api/src/rest.rs b/mullvad-api/src/rest.rs index 9211450cbb..39ed98d370 100644 --- a/mullvad-api/src/rest.rs +++ b/mullvad-api/src/rest.rs @@ -729,20 +729,16 @@ fn flatten_result<T, E>( } } -impl From<hyper::Error> for Error { - fn from(value: hyper::Error) -> Self { - Error::HyperError(Arc::new(value)) - } -} - -impl From<serde_json::Error> for Error { - fn from(value: serde_json::Error) -> Self { - Error::DeserializeError(Arc::new(value)) - } +macro_rules! impl_into_arc_err { + ($ty:ty) => { + impl From<$ty> for Error { + fn from(error: $ty) -> Self { + Error::from(Arc::from(error)) + } + } + }; } -impl From<http::Error> for Error { - fn from(value: http::Error) -> Self { - Error::HttpError(Arc::new(value)) - } -} +impl_into_arc_err!(hyper::Error); +impl_into_arc_err!(serde_json::Error); +impl_into_arc_err!(http::Error); |
