From 320e849d17597aef40b9e3e62f79319f13f97e45 Mon Sep 17 00:00:00 2001 From: Karen Arutyunov Date: Wed, 16 May 2018 16:05:05 +0300 Subject: Fix uncaught invalid_path exception --- build2/parser.cxx | 30 +++++++++++++++++++----------- 1 file changed, 19 insertions(+), 11 deletions(-) (limited to 'build2/parser.cxx') diff --git a/build2/parser.cxx b/build2/parser.cxx index 96465f6..bbce5e5 100644 --- a/build2/parser.cxx +++ b/build2/parser.cxx @@ -150,7 +150,7 @@ namespace build2 const location& loc) { optional e; - const target_type* ti (p.scope_->find_target_type (n, e)); + const target_type* ti (p.scope_->find_target_type (n, e, loc)); if (ti == nullptr) p.fail (loc) << "unknown target type " << n.type; @@ -735,7 +735,7 @@ namespace build2 for (auto& pn: pns) { optional e; - const target_type* ti (scope_->find_target_type (pn, e)); + const target_type* ti (scope_->find_target_type (pn, e, ploc)); if (ti == nullptr) fail (ploc) << "unknown target type " << pn.type; @@ -3104,19 +3104,27 @@ namespace build2 << " pattern"; } - if (s == '+') + try { - if (p) - include_pattern (move (v), a); + if (s == '+') + { + if (p) + include_pattern (move (v), a); + else + include_match (move (v), a); + } else - include_match (move (v), a); + { + if (p) + exclude_pattern (move (v)); + else + exclude_match (v); + } } - else + catch (const invalid_path& e) { - if (p) - exclude_pattern (move (v)); - else - exclude_match (v); + fail (l) << "invalid path '" << e.path << "' in " << what + << " pattern"; } } -- cgit v1.1