Improve error reporting

This commit is contained in:
Michael Vines 2018-06-15 15:29:43 -07:00
parent 04d1a083fa
commit 15c7f36ea3
2 changed files with 11 additions and 5 deletions

View File

@ -395,6 +395,6 @@ fn converge(
}
fn read_leader(path: String) -> ReplicatedData {
let file = File::open(path).expect("file");
serde_json::from_reader(file).expect("parse")
let file = File::open(path.clone()).expect(&format!("file not found: {}", path));
serde_json::from_reader(file).expect(&format!("failed to parse {}", path))
}

View File

@ -115,14 +115,20 @@ fn main() {
if let Ok(data) = serde_json::from_reader(file) {
repl_data = data;
} else {
warn!("failed to parse leader {}, generating new identity", path);
warn!("failed to parse {}, generating new identity", path);
}
} else {
warn!("failed to read {}, generating new identity", path);
}
}
let threads = if matches.opt_present("v") {
eprintln!("starting validator... {}", repl_data.requests_addr);
let path = matches.opt_str("v").unwrap();
let file = File::open(path).expect("file");
eprintln!(
"starting validator... {} using {}",
repl_data.requests_addr, path
);
let file = File::open(path.clone()).expect(&format!("file not found: {}", path));
let leader = serde_json::from_reader(file).expect("parse");
let s = Server::new_validator(
bank,