From 8d53f7f5c8c883bd985fa4b7b02e8a6238cf2708 Mon Sep 17 00:00:00 2001 From: Daniel Friesel Date: Thu, 1 Oct 2020 19:52:11 +0200 Subject: [PATCH] log error when trip_id is missing --- lib/Travelynx/Command/work.pm | 8 ++++++-- lib/Travelynx/Helper/Traewelling.pm | 1 + 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/lib/Travelynx/Command/work.pm b/lib/Travelynx/Command/work.pm index 5a79b10..f38f0e5 100644 --- a/lib/Travelynx/Command/work.pm +++ b/lib/Travelynx/Command/work.pm @@ -265,8 +265,12 @@ sub run { my $trip_id = $candidate->{journey_data}{trip_id}; if ( not $trip_id ) { $self->app->log->debug("... trip_id is missing"); - - # TODO log traewelling error + $self->app->traewelling->log( + uid => $candidate->{uid}, + message => +"Fehler bei $opt{train_type} $opt{train_no}: Keine trip_id vorhanden", + is_error => 1 + ); return; } if ( $candidate->{data}{latest_push_ts} diff --git a/lib/Travelynx/Helper/Traewelling.pm b/lib/Travelynx/Helper/Traewelling.pm index d2ffadc..36af239 100644 --- a/lib/Travelynx/Helper/Traewelling.pm +++ b/lib/Travelynx/Helper/Traewelling.pm @@ -285,6 +285,7 @@ sub checkin { $opt{dep_eva} ); + # Work around https://github.com/Traewelling/traewelling/issues/72 $self->{user_agent}->request_timeout(20) ->get_p( "https://traewelling.de/api/v0/trains/trip?$trip_req" => $header )