From a30be50b746055a1474b90b8bdf01a34776f535d Mon Sep 17 00:00:00 2001 From: Daniel Friesel Date: Fri, 6 Aug 2010 22:08:14 +0200 Subject: Fix internal error handling + tests for it --- bin/efa | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) (limited to 'bin/efa') diff --git a/bin/efa b/bin/efa index 55695f9..d6f7cef 100755 --- a/bin/efa +++ b/bin/efa @@ -88,7 +88,7 @@ $efa = WWW::Efa->new( via => (@via ? [@via, $via_type] : undef), arrive => $opt->{'arrive'}, - depart => $opt->{'depart'}, + depart => $opt->{'depart'} // $opt->{'time'}, date => $opt->{'date'}, exclude => $opt->{'exclude'}, prefer => $opt->{'prefer'}, @@ -100,6 +100,14 @@ $efa = WWW::Efa->new( max_interchanges => $opt->{'max-change'}, ); +if ($efa->{'error'}) { + die $efa->{'error'}->as_string(); +} + +if (ref($efa) eq 'WWW::Efa::Error') { + die($efa->as_string); +} + if ($opt->{'test-parse'}) { local $/ = undef; $efa->{'html_reply'} = ; -- cgit v1.2.3