diff options
author | stuebinm | 2022-01-26 03:20:46 +0100 |
---|---|---|
committer | stuebinm | 2022-01-26 03:20:46 +0100 |
commit | 02ecd1cbd159823b0ab36541b51ee4cb47bf2c95 (patch) | |
tree | 963c60733b17839f2a69cd7a27057e70fdca8a2c | |
parent | e5c5ab0abbc6d3ef1b41563bea1eddf06a9e4839 (diff) |
sadly i'm not on a ICE right now
Diffstat (limited to '')
-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(()) |