From 02ecd1cbd159823b0ab36541b51ee4cb47bf2c95 Mon Sep 17 00:00:00 2001 From: stuebinm Date: Wed, 26 Jan 2022 03:20:46 +0100 Subject: sadly i'm not on a ICE right now --- src/main.rs | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) (limited to 'src') 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::("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(()) -- cgit v1.2.3