Skip to content

Commit

Permalink
Improve error reporting
Browse files Browse the repository at this point in the history
  • Loading branch information
wenyuzhao committed Mar 14, 2024
1 parent 4af1dde commit a1aa492
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions harness-cli/src/commands/run/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -189,6 +189,20 @@ impl RunArgs {
let Some(mut profile) = config.profiles.get(&self.profile).cloned() else {
anyhow::bail!("Could not find harness profile `{}`", self.profile);
};
if self.build.is_some()
&& !profile
.builds
.contains_key(self.build.as_ref().unwrap().as_str())
{
anyhow::bail!(
"Could not find build `{}` in the profile `{}`",
self.build.as_ref().unwrap(),
self.profile
);
}
if !crate_info.benches.contains(bench) {
anyhow::bail!("Could not find benchmark `{}` in the crate", bench);
}
if let Some(iterations) = self.iterations {
profile.iterations = iterations;
}
Expand Down

0 comments on commit a1aa492

Please sign in to comment.