summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorDaniel Friesel <derf@finalrewind.org>2014-01-10 12:03:28 +0100
committerDaniel Friesel <derf@finalrewind.org>2014-01-10 12:03:28 +0100
commit2c41eecea9d7d5ae563e0390514336e95b7c0c0a (patch)
tree4e2312a5905e8d474c0b6df769afb6fb2137fa56 /lib
parent7e8d766d720bc15d9fd701f62ac8901a6531a406 (diff)
IRIS.pm: Errorhandling for stations without associated timetable
Diffstat (limited to 'lib')
-rw-r--r--lib/Travel/Status/DE/IRIS.pm6
1 files changed, 6 insertions, 0 deletions
diff --git a/lib/Travel/Status/DE/IRIS.pm b/lib/Travel/Status/DE/IRIS.pm
index e20d758..1e39377 100644
--- a/lib/Travel/Status/DE/IRIS.pm
+++ b/lib/Travel/Status/DE/IRIS.pm
@@ -49,6 +49,12 @@ sub new {
$self->{nodes}{station} = ( $xml_st->findnodes('//station') )[0];
+ if ( not $self->{node}->{station} ) {
+ $self->{errstr}
+ = "The station '$opt{station}' has no associated timetable";
+ return $self;
+ }
+
my $dt_req = $self->{datetime}->clone;
for ( 1 .. 3 ) {
$self->get_timetable( $self->{nodes}{station}->getAttribute('eva'),