aboutsummaryrefslogtreecommitdiff
path: root/src-tauri/src/mod_management/mod.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src-tauri/src/mod_management/mod.rs')
-rw-r--r--src-tauri/src/mod_management/mod.rs12
1 files changed, 6 insertions, 6 deletions
diff --git a/src-tauri/src/mod_management/mod.rs b/src-tauri/src/mod_management/mod.rs
index 728e72c0..25dea2bb 100644
--- a/src-tauri/src/mod_management/mod.rs
+++ b/src-tauri/src/mod_management/mod.rs
@@ -16,18 +16,18 @@ use app::GameInstall;
struct ParsedThunderstoreModString {
author_name: String,
mod_name: String,
- version: Option<String>,
+ version: String,
}
impl std::str::FromStr for ParsedThunderstoreModString {
- type Err = ();
+ type Err = &'static str; // todo use an better error management
fn from_str(s: &str) -> Result<Self, Self::Err> {
let mut parts = s.split('-');
- let author_name = parts.next().unwrap().to_string();
- let mod_name = parts.next().unwrap().to_string();
- let version = parts.next().map(|s| s.to_string());
+ let author_name = parts.next().ok_or("None value on author_name")?.to_string();
+ let mod_name = parts.next().ok_or("None value on mod_name")?.to_string();
+ let version = parts.next().ok_or("None value on version")?.to_string();
Ok(ParsedThunderstoreModString {
author_name,
@@ -268,7 +268,7 @@ async fn get_ns_mod_download_url(thunderstore_mod_string: &str) -> Result<String
"{}/{}/{}",
parsed_ts_mod_string.author_name,
parsed_ts_mod_string.mod_name,
- parsed_ts_mod_string.version.unwrap()
+ parsed_ts_mod_string.version
);
for ns_mod in index {