Improve error message (#28898)

This commit is contained in:
apfitzge 2022-11-22 10:02:44 -06:00 committed by GitHub
parent 731fe3e5da
commit 08e017b5ba
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 13 additions and 5 deletions

View File

@ -2979,16 +2979,24 @@ fn main() {
value_t_or_exit!(arg_matches, "snapshot_slot", Slot)
};
assert!(
blockstore.meta(snapshot_slot).unwrap().is_some(),
"snapshot slot doesn't exist"
);
if blockstore
.meta(snapshot_slot)
.unwrap()
.filter(|m| m.is_full())
.is_none()
{
eprintln!(
"Error: snapshot slot {} does not exist in blockstore or is not full.",
snapshot_slot,
);
exit(1);
}
let ending_slot = if is_minimized {
let ending_slot = value_t_or_exit!(arg_matches, "ending_slot", Slot);
if ending_slot <= snapshot_slot {
eprintln!(
"ending_slot ({}) must be greater than snapshot_slot ({})",
"Error: ending_slot ({}) must be greater than snapshot_slot ({})",
ending_slot, snapshot_slot
);
exit(1);