Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
T
Travel-Routing-DE-EFA
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
derf
Travel-Routing-DE-EFA
Commits
1470a71a
Commit
1470a71a
authored
10 years ago
by
Birte Kristina Friesel
Browse files
Options
Downloads
Patches
Plain Diff
Improve error messages, especially for ambiguous input values
parent
4d0a56bd
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
bin/efa
+13
-10
13 additions, 10 deletions
bin/efa
lib/Travel/Routing/DE/EFA.pm
+14
-5
14 additions, 5 deletions
lib/Travel/Routing/DE/EFA.pm
with
27 additions
and
15 deletions
bin/efa
+
13
−
10
View file @
1470a71a
...
...
@@ -49,13 +49,13 @@ sub handle_efa_exception {
if
(
$e
->
isa
('
Travel::Routing::DE::EFA::Exception::Setup
')
)
{
if
(
$e
->
message
)
{
printf
STDERR
(
"
E
rror: %s (option '%s'): %s
\n
",
"
User e
rror: %s (option '%s'): %s
\n
",
$e
->
description
,
$e
->
option
,
$e
->
message
);
}
else
{
printf
STDERR
(
"
E
rror: %s (option '%s', got '%s', want '%s')
\n
",
"
User e
rror: %s (option '%s', got '%s', want '%s')
\n
",
$e
->
description
,
$e
->
option
,
$e
->
have
,
$e
->
want
);
}
...
...
@@ -63,27 +63,30 @@ sub handle_efa_exception {
exit
1
;
}
if
(
$e
->
isa
('
Travel::Routing::DE::EFA::Exception::Net
')
)
{
printf
STDERR
(
"
Error: %s: %s
\n
",
$e
->
description
,
$e
->
http_response
->
as_string
);
printf
STDERR
(
"
Network error: %s: %s
\n
",
$e
->
description
,
$e
->
http_response
->
as_string
);
exit
2
;
}
if
(
$e
->
isa
('
Travel::Routing::DE::EFA::Exception::NoData
')
)
{
printf
STDERR
(
"
E
rror: %s
\n
",
$e
->
description
);
printf
STDERR
(
"
Backend
rror: %s
\n
",
$e
->
description
);
exit
3
;
}
if
(
$e
->
isa
('
Travel::Routing::DE::EFA::Exception::Ambiguous
')
)
{
printf
STDERR
(
"
Error: %s for key %s. Specif
y one of %s
\n
",
$e
->
description
,
$e
->
post_
key
,
$e
->
possibilities
"
Backend error: The %s '%s' is ambiguous. Tr
y one of %s
\n
",
$e
->
post_key
,
$e
->
post_
value
,
,
$e
->
possibilities
);
exit
4
;
}
if
(
$e
->
isa
('
Travel::Routing::DE::EFA::Exception::Other
')
)
{
printf
STDERR
(
"
Error: %s: %s
\n
",
$e
->
description
,
$e
->
message
);
printf
STDERR
(
"
Backend error: %s: %s
\n
",
$e
->
description
,
$e
->
message
);
exit
5
;
}
printf
STDERR
(
"
Un
caught exception
: %s
\n
%s
",
ref
(
$e
),
$e
->
trace
);
printf
STDERR
(
"
Un
known error
: %s
\n
%s
",
ref
(
$e
),
$e
->
trace
);
exit
10
;
}
...
...
@@ -235,7 +238,7 @@ if ( $opt->{exclude} ) {
}
if
(
$opt
->
{
service
}
)
{
my
$service
=
first
{
lc
(
$_
->
{
shortname
})
eq
lc
(
$opt
->
{
service
})
}
my
$service
=
first
{
lc
(
$_
->
{
shortname
}
)
eq
lc
(
$opt
->
{
service
}
)
}
Travel::Routing::DE::EFA::
get_efa_urls
();
if
(
not
$service
)
{
printf
STDERR
(
...
...
This diff is collapsed.
Click to expand it.
lib/Travel/Routing/DE/EFA.pm
+
14
−
5
View file @
1470a71a
...
...
@@ -31,7 +31,7 @@ use Exception::Class (
'
Travel::Routing::DE::EFA::Exception::Ambiguous
'
=>
{
isa
=>
'
Travel::Routing::DE::EFA::Exception
',
description
=>
'
ambiguous input
',
fields
=>
[
'
post_key
',
'
possibilities
'
],
fields
=>
[
'
post_key
',
'
post_value
',
'
possibilities
'
],
},
'
Travel::Routing::DE::EFA::Exception::Other
'
=>
{
isa
=>
'
Travel::Routing::DE::EFA::Exception
',
...
...
@@ -687,8 +687,10 @@ sub check_ambiguous_xml {
my
$xp_place
=
XML::LibXML::
XPathExpression
->
new
('
./itdOdvPlace
');
my
$xp_name
=
XML::LibXML::
XPathExpression
->
new
('
./itdOdvName
');
my
$xp_place_elem
=
XML::LibXML::
XPathExpression
->
new
('
./odvPlaceElem
');
my
$xp_name_elem
=
XML::LibXML::
XPathExpression
->
new
('
./odvNameElem
');
my
$xp_place_elem
=
XML::LibXML::
XPathExpression
->
new
('
./odvPlaceElem
');
my
$xp_place_input
=
XML::LibXML::
XPathExpression
->
new
('
./odvPlaceInput
');
my
$xp_name_elem
=
XML::LibXML::
XPathExpression
->
new
('
./odvNameElem
');
my
$xp_name_input
=
XML::LibXML::
XPathExpression
->
new
('
./odvNameInput
');
my
$e_place
=
(
$tree
->
findnodes
(
$xp_place
)
)[
0
];
my
$e_name
=
(
$tree
->
findnodes
(
$xp_name
)
)[
0
];
...
...
@@ -703,7 +705,11 @@ sub check_ambiguous_xml {
if
(
$s_place
eq
'
list
'
)
{
Travel::Routing::DE::EFA::Exception::
Ambiguous
->
throw
(
post_key
=>
'
place
',
post_key
=>
'
place
',
post_value
=>
decode
(
'
UTF-8
',
(
$e_place
->
findnodes
(
$xp_place_input
)
)[
0
]
->
textContent
),
possibilities
=>
join
(
q{ | }
,
map
{
decode
(
'
UTF-8
',
$_
->
textContent
)
}
@
{
$e_place
->
findnodes
(
$xp_place_elem
)
}
)
...
...
@@ -711,7 +717,10 @@ sub check_ambiguous_xml {
}
if
(
$s_name
eq
'
list
'
)
{
Travel::Routing::DE::EFA::Exception::
Ambiguous
->
throw
(
post_key
=>
'
name
',
post_key
=>
'
name
',
post_value
=>
decode
(
'
UTF-8
',
(
$e_name
->
findnodes
(
$xp_name_input
)
)[
0
]
->
textContent
),
possibilities
=>
join
(
q{ | }
,
map
{
decode
(
'
UTF-8
',
$_
->
textContent
)
}
@
{
$e_name
->
findnodes
(
$xp_name_elem
)
}
)
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment