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 ++++++--- src/db.rs | 2 +- 2 files changed, 7 insertions(+), 4 deletions(-) (limited to 'src') 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"), } } diff --git a/src/db.rs b/src/db.rs index c5a972f..06c2459 100644 --- a/src/db.rs +++ b/src/db.rs @@ -361,7 +361,7 @@ pub fn lists_insert(config: Cfg, id: String, mc_version: String, mod_loader: Mod Ok(()) } -pub fn lists_remove(config: Cfg, id: String) -> Result<(), Box> { +pub fn lists_remove(config: Cfg, id: String) -> MLE<()> { let data = devdir(format!("{}/data.db", config.data).as_str()); let connection = Connection::open(data)?; -- cgit v1.2.3