Update main.rs
This commit is contained in:
parent
80f266e194
commit
39609d3534
10
src/main.rs
10
src/main.rs
|
|
@ -1,5 +1,5 @@
|
|||
use std::fs;
|
||||
use std::error::Error;
|
||||
use std::fs;
|
||||
|
||||
mod template;
|
||||
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) {
|
||||
let pretty = serde_json::to_string_pretty(&json_val)?;
|
||||
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 {
|
||||
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()
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue