Skip to content

Commit

Permalink
Catch messages from timetable.search.ch
Browse files Browse the repository at this point in the history
  • Loading branch information
fabian committed Oct 10, 2024
1 parent 3ec9033 commit f940d2d
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions lib/Transport/API.php
Original file line number Diff line number Diff line change
Expand Up @@ -170,6 +170,11 @@ public function getStationBoard(StationBoardQuery $query)
// send request
$result = $this->sendAndParseQuery($query);

// check for API messages
if (isset($result->messages) && is_array($result->messages)) {
throw new \Exception('Messages from timetable.search.ch: '.implode($result->messages));
}

$station = Station::createStationFromJson($result->stop);

$journeys = [];
Expand Down

0 comments on commit f940d2d

Please sign in to comment.