From 84f5d3d58b56a02e4cee2a13050453fafb283b9c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=A3o=20Marcos?= <164224824+marcospb19-cw@users.noreply.github.com> Date: Mon, 25 Nov 2024 11:20:34 -0300 Subject: [PATCH] chore: improve error message when tempStorage kind doesn't match (#1882) --- src/eth/storage/temporary/mod.rs | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/eth/storage/temporary/mod.rs b/src/eth/storage/temporary/mod.rs index fde0a3635..c4aea6663 100644 --- a/src/eth/storage/temporary/mod.rs +++ b/src/eth/storage/temporary/mod.rs @@ -1,4 +1,5 @@ pub use inmemory::InMemoryTemporaryStorage; +use strum::VariantNames; mod inmemory; @@ -77,9 +78,10 @@ pub struct TemporaryStorageConfig { pub temp_storage_kind: TemporaryStorageKind, } -#[derive(DebugAsJson, Clone, serde::Serialize)] +#[derive(DebugAsJson, strum::Display, strum::VariantNames, Clone, Copy, Parser, serde::Serialize)] pub enum TemporaryStorageKind { #[serde(rename = "inmemory")] + #[strum(to_string = "inmemory")] InMemory, } @@ -100,7 +102,7 @@ impl FromStr for TemporaryStorageKind { fn from_str(s: &str) -> anyhow::Result { match s { "inmemory" => Ok(Self::InMemory), - s => Err(anyhow!("unknown temporary storage: {}", s)), + s => Err(anyhow!("unknown temporary storage kind: \"{}\" - valid values are {:?}", s, Self::VARIANTS)), } } }