summaryrefslogtreecommitdiff
path: root/bin/hafas-m
diff options
context:
space:
mode:
authorBirte Kristina Friesel <derf@finalrewind.org>2023-12-26 13:01:06 +0100
committerBirte Kristina Friesel <derf@finalrewind.org>2023-12-26 13:01:49 +0100
commit8eb02b82e48bf9f7a9ca5270648cad6e928c6bda (patch)
treeb5cc8b56c9318e4af7eb43d253dc5aba6e658159 /bin/hafas-m
parent2f14e974b78d7dfbd8faa955faf8e5f8a4dbe713 (diff)
hafas-m: add error check when redirecting from journey match to journey details
Diffstat (limited to 'bin/hafas-m')
-rwxr-xr-xbin/hafas-m13
1 files changed, 13 insertions, 0 deletions
diff --git a/bin/hafas-m b/bin/hafas-m
index b21a968..4b71ca6 100755
--- a/bin/hafas-m
+++ b/bin/hafas-m
@@ -322,6 +322,19 @@ if ( $opt{journeyMatch} ) {
$opt{journey} = { id => $journey->id };
delete $opt{journeyMatch};
$status = Travel::Status::DE::HAFAS->new(%opt);
+ if ( my $err = $status->errstr ) {
+ say STDERR "Request error: ${err}";
+ if (
+ $status->errcode
+ and
+ ( $status->errcode eq 'H730' or $status->errcode eq 'LOCATION' )
+ and not $raw_json_output
+ )
+ {
+ show_similar_stops();
+ }
+ exit 2;
+ }
}
else {
for my $result ( $status->results ) {