summaryrefslogtreecommitdiff
path: root/lib/Travel
diff options
context:
space:
mode:
Diffstat (limited to 'lib/Travel')
-rw-r--r--lib/Travel/Status/DE/HAFAS.pm12
1 files changed, 9 insertions, 3 deletions
diff --git a/lib/Travel/Status/DE/HAFAS.pm b/lib/Travel/Status/DE/HAFAS.pm
index 670cba6..839a599 100644
--- a/lib/Travel/Status/DE/HAFAS.pm
+++ b/lib/Travel/Status/DE/HAFAS.pm
@@ -180,9 +180,15 @@ sub new {
# errors in delay="...") when setting the language to dutch/italian.
# No, I don't know why.
- $ref->{tree} = XML::LibXML->load_xml(
- string => $ref->{raw_xml},
- );
+ eval { $ref->{tree} = XML::LibXML->load_xml( string => $ref->{raw_xml} ) };
+
+ if ( my $err = $@ ) {
+ if ( $ref->{developer_mode} ) {
+ say $ref->{raw_xml};
+ }
+ $ref->{errstr} = "Backend returned invalid XML: $err";
+ return $ref;
+ }
if ( $ref->{developer_mode} ) {
say $ref->{tree}->toString(1);