diff --git a/app/Http/Controllers/HafasController.php b/app/Http/Controllers/HafasController.php index c23a12549..4dcc2e37c 100644 --- a/app/Http/Controllers/HafasController.php +++ b/app/Http/Controllers/HafasController.php @@ -171,9 +171,9 @@ public static function fetchDepartures( TravelType $type = null, bool $skipTimeShift = false ) { - $client = self::getHttpClient(); - $time = $skipTimeShift ? $when : (clone $when)->shiftTimezone("Europe/Berlin"); - $query = [ + $client = self::getHttpClient(); + $time = $skipTimeShift ? $when : (clone $when)->shiftTimezone("Europe/Berlin"); + $query = [ 'when' => $time->toIso8601String(), 'duration' => $duration, HTT::NATIONAL_EXPRESS->value => self::checkTravelType($type, TravelType::EXPRESS), @@ -187,7 +187,11 @@ public static function fetchDepartures( HTT::TRAM->value => self::checkTravelType($type, TravelType::TRAM), HTT::TAXI->value => self::checkTravelType($type, TravelType::TAXI), ]; - $response = $client->get('/stops/' . $station->ibnr . '/departures', $query); + try { + $response = $client->get('/stops/' . $station->ibnr . '/departures', $query); + } catch (Exception $exception) { + throw new HafasException($exception->getMessage()); + } if (!$response->ok()) { throw new HafasException(__('messages.exception.generalHafas')); diff --git a/resources/vue/components/Stationboard.vue b/resources/vue/components/Stationboard.vue index fb929ba52..430b45d5b 100644 --- a/resources/vue/components/Stationboard.vue +++ b/resources/vue/components/Stationboard.vue @@ -112,6 +112,10 @@ export default { this.firstFetchTime = DateTime.fromISO(this.meta?.times?.now); }); + } else { + if (response.status === 502) { + window.notyf.error(trans("messages.exception.hafas.502")) + } } }); },