From a6f76d89efaa561a587290c8a6339fd0b9ebf63d Mon Sep 17 00:00:00 2001 From: Daniel Friesel Date: Sun, 6 Jun 2010 17:05:00 +0200 Subject: Detect efa.vrr.de error messages --- bin/efa | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) (limited to 'bin') diff --git a/bin/efa b/bin/efa index 0670083..4a7f6eb 100755 --- a/bin/efa +++ b/bin/efa @@ -50,6 +50,24 @@ sub check_ambiguous { } } +sub check_no_connections { + my ($full_tree) = @_; + + my $xp_err_img = XML::LibXML::XPathExpression->new( + '//td/img[@src="images/ausrufezeichen.jpg"]'); + + my $err_node = $full_tree->findnodes($xp_err_img)->[0]; + + if ($err_node) { + say "Looks like efa.vrr.de showed an error."; + say "I will now try to dump the error message:"; + + say $err_node->parentNode()->parentNode()->textContent(); + + exit 2; + } +} + sub display_connection { my ($con_parts) = @_; @@ -340,6 +358,7 @@ if ($test_dump) { my $tree = XML::LibXML->load_html(string => $content); check_ambiguous($tree); +check_no_connections($tree); $connections = parse_tree($tree); -- cgit v1.2.3