From dd1b29bc9a1813bc2151635f98231213d3453e78 Mon Sep 17 00:00:00 2001 From: Birte Kristina Friesel Date: Wed, 24 Apr 2024 20:04:54 +0200 Subject: /z/:train/*station: fix 404 respons for JSON requests --- lib/DBInfoscreen/Controller/Stationboard.pm | 19 ++++++++++++++----- 1 file changed, 14 insertions(+), 5 deletions(-) (limited to 'lib/DBInfoscreen') diff --git a/lib/DBInfoscreen/Controller/Stationboard.pm b/lib/DBInfoscreen/Controller/Stationboard.pm index 6893cc0..84fac61 100644 --- a/lib/DBInfoscreen/Controller/Stationboard.pm +++ b/lib/DBInfoscreen/Controller/Stationboard.pm @@ -1098,11 +1098,20 @@ sub station_train_details { )->catch( sub { my ($errstr) = @_; - $self->render( - 'landingpage', - error => - "Keine Abfahrt von $train_no in $station gefunden: $errstr", - status => 404, + $self->respond_to( + json => { + json => { + error => +"Keine Abfahrt von $train_no in $station gefunden: $errstr", + }, + status => 404, + }, + any => { + template => 'landingpage', + error => +"Keine Abfahrt von $train_no in $station gefunden: $errstr", + status => 404, + }, ); return; } -- cgit v1.2.3