Skip to content

Commit

Permalink
chore: improve error message when tempStorage kind doesn't match (#1882)
Browse files Browse the repository at this point in the history
  • Loading branch information
marcospb19-cw authored Nov 25, 2024
1 parent 2304d01 commit 84f5d3d
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/eth/storage/temporary/mod.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
pub use inmemory::InMemoryTemporaryStorage;
use strum::VariantNames;

mod inmemory;

Expand Down Expand Up @@ -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,
}

Expand All @@ -100,7 +102,7 @@ impl FromStr for TemporaryStorageKind {
fn from_str(s: &str) -> anyhow::Result<Self, Self::Err> {
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)),
}
}
}

0 comments on commit 84f5d3d

Please sign in to comment.