aboutsummaryrefslogtreecommitdiff
path: root/libbuild2/config/init.cxx
diff options
context:
space:
mode:
authorBoris Kolpackov <boris@codesynthesis.com>2022-12-09 08:05:46 +0200
committerBoris Kolpackov <boris@codesynthesis.com>2022-12-09 08:05:46 +0200
commitd24c10ce02654454ec1ea60bdfa32e34e2091bf0 (patch)
tree0d02d9c3ed71b4edc1d499e20540410017c010e0 /libbuild2/config/init.cxx
parenta950666a982d92612cdf418b77b2b82e93e7d99c (diff)
Handle file opening error in config.config.load
Diffstat (limited to 'libbuild2/config/init.cxx')
-rw-r--r--libbuild2/config/init.cxx11
1 files changed, 9 insertions, 2 deletions
diff --git a/libbuild2/config/init.cxx b/libbuild2/config/init.cxx
index 7035ce5..46239d8 100644
--- a/libbuild2/config/init.cxx
+++ b/libbuild2/config/init.cxx
@@ -429,8 +429,15 @@ namespace build2
auto load_config_file = [&load_config] (const path& f, const location& l)
{
path_name fn (f);
- ifdstream ifs;
- load_config (open_file_or_stdin (fn, ifs), fn, l);
+ try
+ {
+ ifdstream ifs;
+ load_config (open_file_or_stdin (fn, ifs), fn, l);
+ }
+ catch (const io_error& e)
+ {
+ fail << "unable to read buildfile " << fn << ": " << e;
+ }
};
// Load config.build unless requested not to.