summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Friesel <derf@finalrewind.org>2016-04-30 15:56:38 +0200
committerDaniel Friesel <derf@finalrewind.org>2016-04-30 15:56:38 +0200
commit30110a737aa74a88a07d5eb6b98d84f023c03061 (patch)
tree3a888229ce8fd50fcc346a3c8a8a52e5a9ddfe8b
parent476b70b9f883bd89d7f6470470d1f08a9402c468 (diff)
get_station: set warnstr when a non-root station fetch fails
-rw-r--r--lib/Travel/Status/DE/IRIS.pm18
1 files changed, 15 insertions, 3 deletions
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;
}