Skip to content

Commit

Permalink
Fail gracefully when keypair file is unreadable
Browse files Browse the repository at this point in the history
  • Loading branch information
mvines committed Jul 13, 2018
1 parent fa1cdaa commit 18e6ff4
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion src/bin/wallet.rs
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,13 @@ fn parse_args() -> Result<WalletConfig, Box<error::Error>> {
path.extend(&[".config", "solana", "id.json"]);
path.to_str().unwrap()
};
let id = read_keypair(id_path).expect("client keypair");
let id = read_keypair(id_path).or_else(|err| {
display_actions();
Err(WalletError::BadParameter(format!(
"{}: Unable to open keypair file: {}",
err, id_path
)))
})?;

let mut drone_addr = leader.contact_info.tpu;
drone_addr.set_port(9900);
Expand Down

0 comments on commit 18e6ff4

Please sign in to comment.