diff options
-rw-r--r-- | src/main.rs | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/src/main.rs b/src/main.rs index cbaf251..a0984e6 100644 --- a/src/main.rs +++ b/src/main.rs @@ -140,10 +140,16 @@ fn main() -> Result<(), ureq::Error> { println!("{}: {}", traveltext, resp); } Command::ICEPortal => { - let resp: TripInfo = - exiting_get_request("https://iceportal.de/api1/rs/tripInfo/trip", cli.debug); - println!("{:?}", resp); - println!("guessing last stop was: {:?}", resp.guess_last_station()); + match get_request::<TripInfo>("https://iceportal.de/api1/rs/tripInfo/trip") { + Ok(resp) => { + println!("{:?}", resp); + println!("guessing last stop was: {:?}", resp.guess_last_station()); + } + Err(_) => { + println!("either this tool or the iceportal broke or you're not actually on an ICE\n\ + (get a response but couldn't to parse it)"); + } + } } } Ok(()) |