Skip to content

Commit

Permalink
update validate feature error message (#1091)
Browse files Browse the repository at this point in the history
+ Adds list of valid features to error message

Signed-off-by: Michelle Dhanani <michelle@fermyon.com>
  • Loading branch information
michelleN authored Jun 28, 2023
1 parent e18dc3d commit 0263c2f
Showing 1 changed file with 11 additions and 4 deletions.
15 changes: 11 additions & 4 deletions src/bin/wasm-tools/validate.rs
Original file line number Diff line number Diff line change
Expand Up @@ -139,10 +139,17 @@ fn parse_features(arg: &str) -> Result<WasmFeatures> {
}

name => {
let (_, accessor) = FEATURES
.iter()
.find(|(n, _)| *n == name)
.ok_or_else(|| anyhow!("unknown feature `{}`", name))?;
let (_, accessor) = FEATURES.iter().find(|(n, _)| *n == name).ok_or_else(|| {
anyhow!(
"unknown feature `{}`\nValid features: {}",
name,
FEATURES
.iter()
.map(|(name, _)| *name)
.collect::<Vec<_>>()
.join(", "),
)
})?;
*accessor(&mut ret) = enable;
}
}
Expand Down

0 comments on commit 0263c2f

Please sign in to comment.