Improve error when user doesn't have a wallet (#2231)

## Issue Addressed

NA

## Proposed Changes

I was doing some testing and noticed that this error could be a bit nicer. It helps users understand that they need to create a wallet before a validator.

## Additional Info

NA
This commit is contained in:
Paul Hauner 2021-03-02 05:59:47 +00:00
parent ed9b245de0
commit cc6f7998fd

View File

@ -137,6 +137,18 @@ pub fn cli_run<T: EthSpec>(
let count: Option<usize> = clap_utils::parse_optional(matches, COUNT_FLAG)?; let count: Option<usize> = clap_utils::parse_optional(matches, COUNT_FLAG)?;
let at_most: Option<usize> = clap_utils::parse_optional(matches, AT_MOST_FLAG)?; let at_most: Option<usize> = clap_utils::parse_optional(matches, AT_MOST_FLAG)?;
// The command will always fail if the wallet dir does not exist.
if !wallet_base_dir.exists() {
return Err(format!(
"No wallet directory at {:?}. Use the `lighthouse --network {} {} {} {}` command to create a wallet",
wallet_base_dir,
matches.value_of("network").unwrap_or("<NETWORK>"),
crate::CMD,
crate::wallet::CMD,
crate::wallet::create::CMD
));
}
ensure_dir_exists(&validator_dir)?; ensure_dir_exists(&validator_dir)?;
ensure_dir_exists(&secrets_dir)?; ensure_dir_exists(&secrets_dir)?;