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]]
name = "alterware-launcher"
version = "0.6.8"
version = "0.6.9"
dependencies = [
"colored",
"futures-util",

View File

@ -1,6 +1,6 @@
[package]
name = "alterware-launcher"
version = "0.6.8"
version = "0.6.9"
edition = "2021"
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())
.await
.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();
if args.len() > 1 {