From d8232fa953a08aafce71e0bc9823c554eed59d7c Mon Sep 17 00:00:00 2001 From: GeckoEidechse <40122905+GeckoEidechse@users.noreply.github.com> Date: Wed, 2 Nov 2022 21:26:03 +0100 Subject: refactor: Return error string instead of anyhow!() (#36) All that is returned as the error type is a string so there's no point in using a custom error type when we can just have the error type be a string. Co-authored-by: Remy Raes --- src-tauri/src/lib.rs | 6 ++---- src-tauri/src/main.rs | 8 +------- 2 files changed, 3 insertions(+), 11 deletions(-) (limited to 'src-tauri/src') diff --git a/src-tauri/src/lib.rs b/src-tauri/src/lib.rs index cfc5fb57..5d8d55e6 100644 --- a/src-tauri/src/lib.rs +++ b/src-tauri/src/lib.rs @@ -72,7 +72,7 @@ pub fn linux_checks_librs() -> Result<(), String> { } /// Attempts to find the game install location -pub fn find_game_install_location() -> Result { +pub fn find_game_install_location() -> Result { // Attempt parsing Steam library directly match steamlocate::SteamDir::locate() { Some(mut steamdir) => { @@ -107,9 +107,7 @@ pub fn find_game_install_location() -> Result { } }; - Err(anyhow!( - "Could not auto-detect game install location! Please enter it manually." - )) + Err("Could not auto-detect game install location! Please enter it manually.".to_string()) } /// Returns the current Northstar version number as a string diff --git a/src-tauri/src/main.rs b/src-tauri/src/main.rs index 670baf0b..a0f502b6 100644 --- a/src-tauri/src/main.rs +++ b/src-tauri/src/main.rs @@ -98,13 +98,7 @@ fn main() { #[tauri::command] /// Wrapper for `find_game_install_location` as tauri doesn't allow passing `Result<>` types to front-end async fn find_game_install_location_caller() -> Result { - match find_game_install_location() { - Ok(game_install) => Ok(game_install), - Err(err) => { - println!("{}", err); - Err(err.to_string()) - } - } + find_game_install_location() } #[tauri::command] -- cgit v1.2.3