Skip to content

Commit

Permalink
Better Validation Messages
Browse files Browse the repository at this point in the history
For error and success case
  • Loading branch information
Hubert Ritzdorf committed Sep 3, 2024
1 parent 893654b commit fbd3c25
Showing 1 changed file with 23 additions and 6 deletions.
29 changes: 23 additions & 6 deletions src/dvf.rs
Original file line number Diff line number Diff line change
Expand Up @@ -214,7 +214,7 @@ fn validate_dvf(
}
if seen_events[i].data != critical_event.occurrences[i].data {
return Err(ValidationError::Invalid(format!(
"Validation failed. Mismatching data for event occurrence {} of {}.",
"Mismatching data for event occurrence {} of {}.",
i, critical_event.sig
)));
}
Expand Down Expand Up @@ -1172,25 +1172,42 @@ fn process(matches: ArgMatches) -> Result<(), ValidationError> {
) {
Ok(()) => {
println!(
"Validation succeeded based on block {}.",
"Validation of {} succeeded based on block {}.",
input_path.display(),
validation_block_num
);
exit(0);
}
Err(ValidationError::Error(e)) => {
println!("Validation failed because of an error: {}", e);
println!(
"Validation of {} failed because of an error: {}",
input_path.display(),
e
);
exit(1);
}
Err(ValidationError::Insecure(e)) => {
println!("Validation failed. Insecure Contract found: {}", e);
println!(
"Validation of {} failed. Insecure Contract found: {}",
input_path.display(),
e
);
exit(1);
}
Err(ValidationError::Invalid(e)) => {
println!("Validation failed. Deployment invalid: {}", e);
println!(
"Validation of {} failed. Deployment invalid: {}",
input_path.display(),
e
);
exit(1);
}
Err(ValidationError::NoDVFFound(e)) => {
println!("Validation failed. DVF(s) missing: {}", e);
println!(
"Validation of {} failed. DVF(s) missing: {}",
input_path.display(),
e
);
exit(1);
}
};
Expand Down

0 comments on commit fbd3c25

Please sign in to comment.