write games.json content to file on error

This commit is contained in:
mxve 2024-02-20 19:44:31 +01:00
parent bd26533ae2
commit bb66366f41
3 changed files with 8 additions and 3 deletions

2
Cargo.lock generated
View File

@ -19,7 +19,7 @@ checksum = "f26201604c87b1e01bd3d98f8d5d9a8fcbb815e8cedb41ffccbeb4bf593a35fe"
[[package]] [[package]]
name = "alterware-launcher" name = "alterware-launcher"
version = "0.6.8" version = "0.6.9"
dependencies = [ dependencies = [
"colored", "colored",
"futures-util", "futures-util",

View File

@ -1,6 +1,6 @@
[package] [package]
name = "alterware-launcher" name = "alterware-launcher"
version = "0.6.8" version = "0.6.9"
edition = "2021" edition = "2021"
build = "res/build.rs" build = "res/build.rs"

View File

@ -595,7 +595,12 @@ async fn main() {
let games_json = http_async::get_body_string(format!("{}/games.json", master_url).as_str()) let games_json = http_async::get_body_string(format!("{}/games.json", master_url).as_str())
.await .await
.unwrap(); .unwrap();
let games: Vec<Game> = serde_json::from_str(&games_json).unwrap(); let games: Vec<Game> = 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(); let mut game: String = String::new();
if args.len() > 1 { if args.len() > 1 {