From 30110a737aa74a88a07d5eb6b98d84f023c03061 Mon Sep 17 00:00:00 2001 From: Daniel Friesel Date: Sat, 30 Apr 2016 15:56:38 +0200 Subject: get_station: set warnstr when a non-root station fetch fails --- lib/Travel/Status/DE/IRIS.pm | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) (limited to 'lib/Travel/Status') diff --git a/lib/Travel/Status/DE/IRIS.pm b/lib/Travel/Status/DE/IRIS.pm index 6cdf092..4461e01 100644 --- a/lib/Travel/Status/DE/IRIS.pm +++ b/lib/Travel/Status/DE/IRIS.pm @@ -173,8 +173,15 @@ sub get_station { = $self->get_with_cache( $self->{main_cache}, $self->{iris_base} . '/station/' . $station ); if ($err) { - $self->{errstr} = "Failed to fetch station data: $err"; - return; + if ( $opt{root} ) { + $self->{errstr} = "Failed to fetch station data: $err"; + return; + } + else { + $self->{warnstr} + = "Failed to fetch station data for '$station': $err\n"; + next; + } } my $xml_st = XML::LibXML->load_xml( string => $raw ); @@ -184,9 +191,14 @@ sub get_station { if ( not $station_node ) { if ( $opt{root} ) { $self->{errstr} - = "The station '$opt{name}' has no associated timetable"; + = "Station '$station' has no associated timetable"; return; } + else { + $self->{warnstr} + = "Station '$station' has no associated timetable"; + next; + } next; } -- cgit v1.2.3