diff options
author | GeckoEidechse <gecko.eidechse+git@pm.me> | 2022-09-10 16:49:59 +0200 |
---|---|---|
committer | GeckoEidechse <gecko.eidechse+git@pm.me> | 2022-09-10 16:49:59 +0200 |
commit | 209f3372f7ff023a842a8d186130032397e5ad87 (patch) | |
tree | 21927aadcc9eab2a5f258dcac9c2221ebd4b24bf | |
parent | 50a96674c08b3cfd14715789317cf3c7b0e2dffc (diff) | |
download | FlightCore-209f3372f7ff023a842a8d186130032397e5ad87.tar.gz FlightCore-209f3372f7ff023a842a8d186130032397e5ad87.zip |
Return error result type if NS update check fails
-rw-r--r-- | src-tauri/src/main.rs | 8 | ||||
-rw-r--r-- | src-ui/src/main.ts | 15 |
2 files changed, 15 insertions, 8 deletions
diff --git a/src-tauri/src/main.rs b/src-tauri/src/main.rs index 60b434fc..0b22eaff 100644 --- a/src-tauri/src/main.rs +++ b/src-tauri/src/main.rs @@ -113,7 +113,7 @@ fn get_northstar_version_number_caller(game_path: String) -> String { /// Checks if installed Northstar version is up-to-date /// false -> Northstar install is up-to-date /// true -> Northstar install is outdated -async fn check_is_northstar_outdated(game_path: String) -> bool { +async fn check_is_northstar_outdated(game_path: String) -> Result<bool, String> { let index = thermite::api::get_package_index().await.unwrap().to_vec(); let nmod = index .iter() @@ -128,16 +128,16 @@ async fn check_is_northstar_outdated(game_path: String) -> bool { Err(err) => { println!("{}", err); // If we fail to get new version just assume we are up-to-date - return false; + return Err(err.to_string()); } }; if version_number != nmod.version { println!("Installed Northstar version outdated"); - true + Ok(true) } else { println!("Installed Northstar version up-to-date"); - false + Ok(false) } } diff --git a/src-ui/src/main.ts b/src-ui/src/main.ts index 3b2d2f7d..e733cf4d 100644 --- a/src-ui/src/main.ts +++ b/src-ui/src/main.ts @@ -21,10 +21,17 @@ async function get_northstar_version_number_and_set_button_accordingly(omniButto if (northstar_version_number && northstar_version_number.length > 0) { globalState.installed_northstar_version = northstar_version_number; omniButtonEl.textContent = `${button_play_string} (${northstar_version_number})`; - let northstar_is_outdated = await invoke("check_is_northstar_outdated", { gamePath: globalState.gamepath }) as boolean; - if (northstar_is_outdated) { - omniButtonEl.textContent = button_update_string; - } + await invoke("check_is_northstar_outdated", { gamePath: globalState.gamepath }) + .then((message) => { + console.log(message); + if (message) { + omniButtonEl.textContent = button_update_string; + } + }) + .catch((error) => { + console.error(error); + alert(error); + }); } } |