From bb66366f4184007d7279f3c76d569fbedf1ee36c Mon Sep 17 00:00:00 2001 From: mxve <68632137+mxve@users.noreply.github.com> Date: Tue, 20 Feb 2024 19:44:31 +0100 Subject: [PATCH] write games.json content to file on error --- Cargo.lock | 2 +- Cargo.toml | 2 +- src/main.rs | 7 ++++++- 3 files changed, 8 insertions(+), 3 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 473e03c..6fbd86a 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -19,7 +19,7 @@ checksum = "f26201604c87b1e01bd3d98f8d5d9a8fcbb815e8cedb41ffccbeb4bf593a35fe" [[package]] name = "alterware-launcher" -version = "0.6.8" +version = "0.6.9" dependencies = [ "colored", "futures-util", diff --git a/Cargo.toml b/Cargo.toml index 3b07db7..f5bcb1b 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "alterware-launcher" -version = "0.6.8" +version = "0.6.9" edition = "2021" build = "res/build.rs" diff --git a/src/main.rs b/src/main.rs index ae360d7..15558a1 100644 --- a/src/main.rs +++ b/src/main.rs @@ -595,7 +595,12 @@ async fn main() { let games_json = http_async::get_body_string(format!("{}/games.json", master_url).as_str()) .await .unwrap(); - let games: Vec = serde_json::from_str(&games_json).unwrap(); + let games: Vec = serde_json::from_str(&games_json).unwrap_or_else(|error| { + println!("Error parsing games.json: {:#?}", error); + fs::write("alterware-launcher-error.txt", &games_json).unwrap(); + misc::stdin(); + std::process::exit(1); + }); let mut game: String = String::new(); if args.len() > 1 {