Improve error message when unable to read a file (#6978)
This commit is contained in:
@ -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>> {
|
||||
|
Reference in New Issue
Block a user