summaryrefslogtreecommitdiff
path: root/src/commands/update.rs
diff options
context:
space:
mode:
authorfxqnlr <[email protected]>2023-01-09 23:12:52 +0100
committerfxqnlr <[email protected]>2023-01-09 23:12:52 +0100
commit89193143f90e1b8cbb91445d14942fa39509acbb (patch)
tree4aeb60ae2aceffc2468589c615ead9dc7079a34d /src/commands/update.rs
parent94d7656cce4ca751be545eeb2ff52bdea1f37fa0 (diff)
downloadmodlist-89193143f90e1b8cbb91445d14942fa39509acbb.tar
modlist-89193143f90e1b8cbb91445d14942fa39509acbb.tar.gz
modlist-89193143f90e1b8cbb91445d14942fa39509acbb.zip
implemented more Error (dumb)
Diffstat (limited to 'src/commands/update.rs')
-rw-r--r--src/commands/update.rs8
1 files changed, 4 insertions, 4 deletions
diff --git a/src/commands/update.rs b/src/commands/update.rs
index 11f283e..ca28130 100644
--- a/src/commands/update.rs
+++ b/src/commands/update.rs
@@ -1,8 +1,8 @@
1use std::io::{Error, ErrorKind}; 1use std::io::{Error, ErrorKind};
2 2
3use crate::{config::Cfg, modrinth::{projects, Project, versions, extract_current_version, Version}, get_current_list, db::{userlist_get_all_ids, mods_get_versions, userlist_get_applicable_versions, userlist_change_versions, lists_get_all_ids, lists_get, userlist_get_current_version, mods_change_versions}, List, input::Input, files::{delete_version, download_versions, disable_version}}; 3use crate::{config::Cfg, modrinth::{projects, Project, versions, extract_current_version, Version}, get_current_list, db::{userlist_get_all_ids, mods_get_versions, userlist_get_applicable_versions, userlist_change_versions, lists_get_all_ids, lists_get, userlist_get_current_version, mods_change_versions}, List, input::Input, files::{delete_version, download_versions, disable_version}, error::{MLE, MLError, ErrorType}};
4 4
5pub async fn update(config: Cfg, input: Input) -> Result<(), Box<dyn std::error::Error>> { 5pub async fn update(config: Cfg, input: Input) -> MLE<()> {
6 6
7 let mut liststack: Vec<List> = vec![]; 7 let mut liststack: Vec<List> = vec![];
8 if input.all_lists { 8 if input.all_lists {
@@ -19,7 +19,7 @@ pub async fn update(config: Cfg, input: Input) -> Result<(), Box<dyn std::error:
19 cmd_update(config, liststack, input.clean, input.direct_download, input.delete_old).await 19 cmd_update(config, liststack, input.clean, input.direct_download, input.delete_old).await
20} 20}
21 21
22pub async fn cmd_update(config: Cfg, liststack: Vec<List>, clean: bool, direct_download: bool, delete_old: bool) -> Result<(), Box<dyn std::error::Error>> { 22pub async fn cmd_update(config: Cfg, liststack: Vec<List>, clean: bool, direct_download: bool, delete_old: bool) -> MLE<()> {
23 for current_list in liststack { 23 for current_list in liststack {
24 let mods = userlist_get_all_ids(config.clone(), current_list.clone().id)?; 24 let mods = userlist_get_all_ids(config.clone(), current_list.clone().id)?;
25 25
@@ -37,7 +37,7 @@ pub async fn cmd_update(config: Cfg, liststack: Vec<List>, clean: bool, direct_d
37 let current_version = &versions[index]; 37 let current_version = &versions[index];
38 let p_id = String::from(&project.id); 38 let p_id = String::from(&project.id);
39 let v_id = &current_version.mod_id; 39 let v_id = &current_version.mod_id;
40 if &p_id != v_id { return Err(Box::new(Error::new(ErrorKind::Other, "SORTING_ERROR"))) }; 40 if &p_id != v_id { return Err(MLError::new(ErrorType::Other, "SORTING_ERROR")) };
41 41
42 //Getting current installed version for disable or delete 42 //Getting current installed version for disable or delete
43 let disable_version = userlist_get_current_version(config.clone(), String::from(&current_list.id), String::from(&project.id))?; 43 let disable_version = userlist_get_current_version(config.clone(), String::from(&current_list.id), String::from(&project.id))?;