From d24c10ce02654454ec1ea60bdfa32e34e2091bf0 Mon Sep 17 00:00:00 2001 From: Boris Kolpackov Date: Fri, 9 Dec 2022 08:05:46 +0200 Subject: Handle file opening error in config.config.load --- libbuild2/config/init.cxx | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) (limited to 'libbuild2') 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. -- cgit v1.1