From bf8e9b3d7126ab5c4e826c2a76d2492902e84f91 Mon Sep 17 00:00:00 2001 From: sakridge Date: Sun, 8 Mar 2020 19:19:34 -0700 Subject: [PATCH] Better error message for cli (#8702) --- clap-utils/src/keypair.rs | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/clap-utils/src/keypair.rs b/clap-utils/src/keypair.rs index ccfc0e1e61..9502d1d435 100644 --- a/clap-utils/src/keypair.rs +++ b/clap-utils/src/keypair.rs @@ -75,7 +75,14 @@ pub fn signer_from_path( false, )?)) } - KeypairUrl::Filepath(path) => Ok(Box::new(read_keypair_file(&path)?)), + KeypairUrl::Filepath(path) => match read_keypair_file(&path) { + Err(e) => Err(Error::with_description( + &format!("Couldn't find keypair file: {:?} error: {:?}", path, e), + ErrorKind::InvalidValue, + ) + .into()), + Ok(file) => Ok(Box::new(file)), + }, KeypairUrl::Stdin => { let mut stdin = std::io::stdin(); Ok(Box::new(read_keypair(&mut stdin)?))