From d29961ee19acc403f483cfc704f3a475dab4787c Mon Sep 17 00:00:00 2001 From: Tobie Morgan Hitchcock Date: Wed, 11 May 2022 21:43:11 +0100 Subject: [PATCH] Ensure Errors can be converted into Strings --- lib/src/err/mod.rs | 6 ++++++ src/err/mod.rs | 6 ++++++ 2 files changed, 12 insertions(+) diff --git a/lib/src/err/mod.rs b/lib/src/err/mod.rs index 9d8d3545..f8861aa1 100644 --- a/lib/src/err/mod.rs +++ b/lib/src/err/mod.rs @@ -234,6 +234,12 @@ pub enum Error { Decode(#[from] DecodeError), } +impl From for String { + fn from(e: Error) -> String { + e.to_string() + } +} + #[cfg(feature = "kv-echodb")] impl From for Error { fn from(e: EchoDBError) -> Error { diff --git a/src/err/mod.rs b/src/err/mod.rs index 342f5f60..18045988 100644 --- a/src/err/mod.rs +++ b/src/err/mod.rs @@ -38,6 +38,12 @@ pub enum Error { impl warp::reject::Reject for Error {} +impl From for String { + fn from(e: Error) -> String { + e.to_string() + } +} + impl From for Error { fn from(_: Base64Error) -> Error { Error::InvalidAuth