JSON response only printed on parsing errors

This commit is contained in:
Ollo 2023-09-15 19:00:10 +02:00
parent b897ec3739
commit ca697f53c9

View File

@ -90,12 +90,14 @@ pub fn fetch_data() -> Option<&'static str> {
return Option::None;
}
let rawText = &text.unwrap();
println!("{}", &rawText);
let body: std::result::Result<Station, serde_json::Error> = serde_json::from_str(&rawText);
if body.is_err() {
println!("Could not parse json {:?}", body.err());
println!("------------------------- %< ----------------------------");
println!("{}", &rawText);
println!("------------------------- %< ----------------------------");
return Option::None;
}