From e6153b23d0824abdb324191e1622bfd4226dc38b Mon Sep 17 00:00:00 2001 From: Boris Kolpackov Date: Mon, 8 May 2017 15:57:06 +0200 Subject: Soft-fail if result manifest is broken --- bbot/utility.txx | 27 +++++++++++++++++---------- 1 file changed, 17 insertions(+), 10 deletions(-) (limited to 'bbot/utility.txx') diff --git a/bbot/utility.txx b/bbot/utility.txx index 688eb9c..31f9cdf 100644 --- a/bbot/utility.txx +++ b/bbot/utility.txx @@ -155,26 +155,33 @@ namespace bbot // template T - parse_manifest (const path& f, const char* what, bool ignore_unknown) + parse_manifest (const path& f, const char* what, bool fh, bool iu) { using namespace butl; try { if (f.string () == "-") - return parse_manifest (std::cin, "stdin", what, ignore_unknown); + return parse_manifest (std::cin, "stdin", what, fh, iu); - if (!file_exists (f)) - fail << what << " manifest file " << f << " does not exist"; + if (file_exists (f)) + { + ifdstream ifs (f); + return parse_manifest (ifs, f.string (), what, fh, iu); + } - ifdstream ifs (f); - return parse_manifest (ifs, f.string (), what, true, ignore_unknown); + diag_record dr; if (fh) dr << fail; else dr << error; + + dr << what << " manifest file " << f << " does not exist"; } catch (const system_error& e) // EACCES, etc. { - fail << "unable to access " << what << " manifest " << f << ": " << e - << endf; + diag_record dr; if (fh) dr << fail; else dr << error; + + dr << "unable to access " << what << " manifest " << f << ": " << e; } + + throw failed (); } template @@ -183,14 +190,14 @@ namespace bbot const string& name, const char* what, bool fh, - bool ignore_unknown) + bool iu) { using namespace butl; try { manifest_parser p (is, name); - return T (p, ignore_unknown); + return T (p, iu); } catch (const manifest_parsing& e) { -- cgit v1.1