From fad32c31b59001bed46fa860fbc3a994d278e700 Mon Sep 17 00:00:00 2001 From: fxqnlr Date: Wed, 11 Jan 2023 17:31:17 +0100 Subject: cargo update, minor error impls --- src/commands/list.rs | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) (limited to 'src/commands') diff --git a/src/commands/list.rs b/src/commands/list.rs index a02f8b1..3998cce 100644 --- a/src/commands/list.rs +++ b/src/commands/list.rs @@ -23,7 +23,10 @@ pub async fn list(config: Cfg, input: Input) -> Result<(), Box { - remove(config, input.args.ok_or("")?) + match remove(config, input.args.ok_or("")?) { + Ok(..) => Ok(()), + Err(e) => Err(Box::new(e)) + } }, Subcmd::Version => { match version(config, Some(input.args.ok_or("NO_VERSION")?), Some(MCVersionType::Release)).await { @@ -72,10 +75,10 @@ fn change(config: Cfg, args: Option>) -> Result<(), Box) -> Result<(), Box> { +fn remove(config: Cfg, args: Vec) -> MLE<()> { match args.len() { 1 => lists_remove(config, String::from(&args[0])), - 2.. => Err(Box::new(Error::new(ErrorKind::InvalidInput, "TOO_MANY_ARGUMENTS"))), + 2.. => Err(MLError::new(ErrorType::ArgumentCountError, "TOO_MANY_ARGUMENTS")), _ => panic!("list arguments should never be zero or lower"), } } -- cgit v1.2.3