Skip to content

Commit

Permalink
remove errant panic, improve logs for bad config
Browse files Browse the repository at this point in the history
  • Loading branch information
zeroXbrock committed Nov 15, 2024
1 parent 171cf6c commit 3677be8
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions crates/core/src/generator/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,13 @@ where
fn parse_map_key(fuzz: FuzzParam) -> Result<String> {
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,
));
}
Expand All @@ -74,7 +80,7 @@ fn parse_map_key(fuzz: FuzzParam) -> Result<String> {
}
VALUE_KEY.to_owned()
} else {
panic!("this should never happen");
return Err(ContenderError::SpamError("this should never happen", None));
};

Ok(key)
Expand Down

0 comments on commit 3677be8

Please sign in to comment.