diff options
author | GeckoEidechse <gecko.eidechse+git@pm.me> | 2023-05-06 01:50:03 +0200 |
---|---|---|
committer | GeckoEidechse <gecko.eidechse+git@pm.me> | 2023-05-06 01:50:03 +0200 |
commit | 7efd2f5c5e9e380ca463d97a54b862da6b96da16 (patch) | |
tree | d2c6624e5e350fb04d14144fa25a0a66db51c383 /src-tauri/src/mod_management/mod.rs | |
parent | 10616b295eb23c8250a0d874fe05211f73a8ba81 (diff) | |
parent | d15190c1fa16420c44d3c9f4a2b58b0f5826178b (diff) | |
download | FlightCore-7efd2f5c5e9e380ca463d97a54b862da6b96da16.tar.gz FlightCore-7efd2f5c5e9e380ca463d97a54b862da6b96da16.zip |
Merge branch 'main' into fix/handle-failed-downloadfix/handle-failed-download
Diffstat (limited to 'src-tauri/src/mod_management/mod.rs')
-rw-r--r-- | src-tauri/src/mod_management/mod.rs | 12 |
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 { |