From 4099874de2109fa0c593f0643840b3995681f008 Mon Sep 17 00:00:00 2001 From: rascul Date: Fri, 15 Mar 2024 21:34:43 -0500 Subject: [PATCH] add askama::Error behind feature flag --- Cargo.toml | 1 + src/lib.rs | 7 +++++++ 2 files changed, 8 insertions(+) diff --git a/Cargo.toml b/Cargo.toml index 080c69e..a956dda 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -8,6 +8,7 @@ license = "MIT" keywords = ["error", "result"] [dependencies] +askama = { version = "0.12", optional = true } serde_json = { version = "1.0", optional = true } ureq = { version = "2.6", optional = true } diff --git a/src/lib.rs b/src/lib.rs index 6ea5662..ccca25b 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -63,6 +63,13 @@ impl From for Rear { } } +#[cfg(feature = "askama")] +impl From for Rear { + fn from(error: askama::Error) -> Self { + Self { message: error.to_string(), error: error.into() } + } +} + #[cfg(feature = "serde_json")] impl From for Rear { fn from(error: serde_json::Error) -> Self {