aboutsummaryrefslogtreecommitdiff
path: root/build2/scope.cxx
diff options
context:
space:
mode:
authorKaren Arutyunov <karen@codesynthesis.com>2018-05-16 16:05:05 +0300
committerKaren Arutyunov <karen@codesynthesis.com>2018-05-16 16:28:12 +0300
commit320e849d17597aef40b9e3e62f79319f13f97e45 (patch)
tree9d6e4254c5461bfd3547aa4aa2d21057f77ee1b9 /build2/scope.cxx
parent5d54628076bd7fc97e90c81b6d0df0fef4ceae20 (diff)
Fix uncaught invalid_path exception
Diffstat (limited to 'build2/scope.cxx')
-rw-r--r--build2/scope.cxx12
1 files changed, 10 insertions, 2 deletions
diff --git a/build2/scope.cxx b/build2/scope.cxx
index a15eeba..e5762f1 100644
--- a/build2/scope.cxx
+++ b/build2/scope.cxx
@@ -569,7 +569,7 @@ namespace build2
static const string file_tt ("file");
const target_type* scope::
- find_target_type (name& n, optional<string>& ext) const
+ find_target_type (name& n, optional<string>& ext, const location& loc) const
{
ext = nullopt;
@@ -622,7 +622,15 @@ namespace build2
if (i != string::npos)
{
- n.dir /= dir_path (v, i != 0 ? i : 1); // Special case: "/".
+ try
+ {
+ n.dir /= dir_path (v, i != 0 ? i : 1); // Special case: "/".
+ }
+ catch (const invalid_path& e)
+ {
+ fail (loc) << "invalid path '" << e.path << "'";
+ }
+
v = string (v, i + 1, string::npos);
}