Update main.rs

This commit is contained in:
Villers Krisztián 2026-04-30 15:34:35 +02:00
parent 80f266e194
commit 39609d3534
1 changed files with 7 additions and 3 deletions

View File

@ -1,5 +1,5 @@
use std::fs;
use std::error::Error; use std::error::Error;
use std::fs;
mod template; mod template;
use template::antares::Antares; use template::antares::Antares;
@ -36,10 +36,14 @@ fn main() -> Result<(), Box<dyn Error>> {
if let Ok(json_val) = serde_json::from_str::<serde_json::Value>(&response) { if let Ok(json_val) = serde_json::from_str::<serde_json::Value>(&response) {
let pretty = serde_json::to_string_pretty(&json_val)?; let pretty = serde_json::to_string_pretty(&json_val)?;
fs::write("antares.json", pretty)?; fs::write("antares.json", pretty)?;
eprintln!("Warning: response didn't match expected struct but was valid JSON; saved pretty JSON to antares.json"); eprintln!(
"Warning: response didn't match expected struct but was valid JSON; saved pretty JSON to antares.json"
);
} else { } else {
fs::write("antares.json", &response)?; fs::write("antares.json", &response)?;
eprintln!("Warning: response is not valid JSON; saved raw response to antares.json"); eprintln!(
"Warning: response is not valid JSON; saved raw response to antares.json"
);
} }
Vec::new() Vec::new()
} }