Improve error message when unable to read a file (#6978)
This commit is contained in:
parent
59413b3124
commit
892ca196f1
|
@ -33,6 +33,7 @@ pub enum AccountFileFormat {
|
|||
fn pubkey_from_file(key_file: &str) -> Result<Pubkey, Box<dyn error::Error>> {
|
||||
read_pubkey_file(key_file)
|
||||
.or_else(|_| read_keypair_file(key_file).map(|keypair| keypair.pubkey()))
|
||||
.map_err(|err| format!("Failed to read {}: {}", key_file, err).into())
|
||||
}
|
||||
|
||||
fn pubkey_from_str(key_str: &str) -> Result<Pubkey, Box<dyn error::Error>> {
|
||||
|
|
Loading…
Reference in New Issue