JSON response only printed on parsing errors
This commit is contained in:
parent
b897ec3739
commit
ca697f53c9
@ -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;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user