From ed9cf91cfbabfb609de40524f505434b1f658309 Mon Sep 17 00:00:00 2001 From: Carson McManus Date: Sun, 19 Jun 2022 12:45:33 -0400 Subject: [PATCH] return better error for unimplemented subcommand --- src/errors.rs | 2 ++ src/main.rs | 3 +-- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/src/errors.rs b/src/errors.rs index 0def6f0..b61bdb0 100644 --- a/src/errors.rs +++ b/src/errors.rs @@ -4,4 +4,6 @@ use thiserror::Error; pub(crate) enum UserError { #[error("User aborted the operation.")] Aborted, + #[error("Unknown subcommand. It may need to be implemented.")] + UnknownSubcommand, } diff --git a/src/main.rs b/src/main.rs index bbdddbb..693e156 100644 --- a/src/main.rs +++ b/src/main.rs @@ -273,14 +273,13 @@ fn run() -> anyhow::Result<()> { }, Some(s) => { error!("Unknown subcommand: {:?}", s); + return Err(errors::UserError::UnknownSubcommand.into()); }, _ => { debug!("No subcommand given, assuming user wants a 2fa code"); return do_subcmd_code(selected_accounts); } } - - Ok(()) } fn get_selected_accounts(