From 3677be8ea48d33d2c30d7a7b2736182d807a5a0b Mon Sep 17 00:00:00 2001 From: zeroXbrock <2791467+zeroXbrock@users.noreply.github.com> Date: Thu, 14 Nov 2024 16:03:25 -0800 Subject: [PATCH] remove errant panic, improve logs for bad config --- crates/core/src/generator/mod.rs | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/crates/core/src/generator/mod.rs b/crates/core/src/generator/mod.rs index cfcd53f..9cc2662 100644 --- a/crates/core/src/generator/mod.rs +++ b/crates/core/src/generator/mod.rs @@ -58,7 +58,13 @@ where fn parse_map_key(fuzz: FuzzParam) -> Result { if fuzz.param.is_none() && fuzz.value.is_none() { return Err(ContenderError::SpamError( - "fuzz must specify one of `param` or `value`", + "fuzz must specify either `param` or `value`", + None, + )); + } + if fuzz.param.is_some() && fuzz.value.is_some() { + return Err(ContenderError::SpamError( + "fuzz cannot specify both `param` and `value`; choose one per fuzz directive", None, )); } @@ -74,7 +80,7 @@ fn parse_map_key(fuzz: FuzzParam) -> Result { } VALUE_KEY.to_owned() } else { - panic!("this should never happen"); + return Err(ContenderError::SpamError("this should never happen", None)); }; Ok(key)