return better error for unimplemented subcommand

This commit is contained in:
Carson McManus 2022-06-19 12:45:33 -04:00
parent e653ac684f
commit ed9cf91cfb
2 changed files with 3 additions and 2 deletions

View file

@ -4,4 +4,6 @@ use thiserror::Error;
pub(crate) enum UserError { pub(crate) enum UserError {
#[error("User aborted the operation.")] #[error("User aborted the operation.")]
Aborted, Aborted,
#[error("Unknown subcommand. It may need to be implemented.")]
UnknownSubcommand,
} }

View file

@ -273,14 +273,13 @@ fn run() -> anyhow::Result<()> {
}, },
Some(s) => { Some(s) => {
error!("Unknown subcommand: {:?}", s); error!("Unknown subcommand: {:?}", s);
return Err(errors::UserError::UnknownSubcommand.into());
}, },
_ => { _ => {
debug!("No subcommand given, assuming user wants a 2fa code"); debug!("No subcommand given, assuming user wants a 2fa code");
return do_subcmd_code(selected_accounts); return do_subcmd_code(selected_accounts);
} }
} }
Ok(())
} }
fn get_selected_accounts( fn get_selected_accounts(