From 47e92c8044ff618ccbb4e9f1cb6afa544aa4225c Mon Sep 17 00:00:00 2001 From: Michael Vines Date: Fri, 15 Jun 2018 15:29:43 -0700 Subject: [PATCH] Improve error reporting --- src/bin/client-demo.rs | 4 ++-- src/bin/fullnode.rs | 12 +++++++++--- 2 files changed, 11 insertions(+), 5 deletions(-) diff --git a/src/bin/client-demo.rs b/src/bin/client-demo.rs index 61c1d5fd976bd4..af1c01271d17be 100644 --- a/src/bin/client-demo.rs +++ b/src/bin/client-demo.rs @@ -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)) } diff --git a/src/bin/fullnode.rs b/src/bin/fullnode.rs index adda2aa8953fd4..273f740586e084 100644 --- a/src/bin/fullnode.rs +++ b/src/bin/fullnode.rs @@ -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,