From f7a6d2e9c67c1fdf8fc17fa0461a201fd2720537 Mon Sep 17 00:00:00 2001 From: fxqnlr Date: Thu, 19 Jan 2023 18:37:42 +0100 Subject: input mostly inplemented, mods missing --- src/db.rs | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) (limited to 'src/db.rs') diff --git a/src/db.rs b/src/db.rs index 06c2459..119b2a5 100644 --- a/src/db.rs +++ b/src/db.rs @@ -177,7 +177,7 @@ pub fn userlist_get_all_ids(config: Cfg, list_id: String) -> MLE> { } -pub fn userlist_remove(config: Cfg, list_id: String, mod_id: String) -> Result<(), Box> { +pub fn userlist_remove(config: Cfg, list_id: String, mod_id: String) -> MLE<()> { let data = devdir(format!("{}/data.db", config.data).as_str()); let connection = Connection::open(data)?; @@ -186,7 +186,7 @@ pub fn userlist_remove(config: Cfg, list_id: String, mod_id: String) -> Result<( } -pub fn userlist_get_applicable_versions(config: Cfg, list_id: String, mod_id: String) -> Result> { +pub fn userlist_get_applicable_versions(config: Cfg, list_id: String, mod_id: String) -> MLE { let data = devdir(format!("{}/data.db", config.data).as_str()); let connection = Connection::open(data).unwrap(); @@ -201,12 +201,12 @@ pub fn userlist_get_applicable_versions(config: Cfg, list_id: String, mod_id: St }; match version.is_empty() { - true => Err(Box::new(Error::new(ErrorKind::NotFound, "MOD_NOT_FOUND"))), + true => Err(MLError::new(ErrorType::DBError, "MOD_NOT_FOUND")), false => Ok(version), } } -pub fn userlist_get_all_applicable_versions_with_mods(config: Cfg, list_id: String) -> Result, Box> { +pub fn userlist_get_all_applicable_versions_with_mods(config: Cfg, list_id: String) -> MLE> { let data = devdir(format!("{}/data.db", config.data).as_str()); let connection = Connection::open(data)?; @@ -221,7 +221,7 @@ pub fn userlist_get_all_applicable_versions_with_mods(config: Cfg, list_id: Stri versions.push((out[0].to_owned(), out[1].to_owned())); }; - if versions.is_empty() { return Err(Box::new(std::io::Error::new(ErrorKind::Other, "NO_MODS_ON_LIST"))); }; + if versions.is_empty() { return Err(MLError::new(ErrorType::DBError, "NO_MODS_ON_LIST")); }; Ok(versions) } @@ -349,6 +349,7 @@ pub fn userlist_get_all_downloads(config: Cfg, list_id: String) -> Result MLE<()> { println!("Creating list {}", id); @@ -420,7 +421,7 @@ pub fn lists_get_all_ids(config: Cfg) -> MLE> { } //config -pub fn config_change_current_list(config: Cfg, id: String) -> Result<(), Box> { +pub fn config_change_current_list(config: Cfg, id: String) -> MLE<()> { let data = devdir(format!("{}/data.db", config.data).as_str()); let connection = Connection::open(data)?; -- cgit v1.2.3