diff options
author | Boris Kolpackov <boris@codesynthesis.com> | 2017-05-08 15:57:06 +0200 |
---|---|---|
committer | Boris Kolpackov <boris@codesynthesis.com> | 2017-05-08 15:57:06 +0200 |
commit | e6153b23d0824abdb324191e1622bfd4226dc38b (patch) | |
tree | 43745bf3a681fd5649ceab5ace4c7790efe7a429 /bbot/utility.txx | |
parent | 7848221ece63119220464dcf1c5868db168effd2 (diff) |
Soft-fail if result manifest is broken
Diffstat (limited to 'bbot/utility.txx')
-rw-r--r-- | bbot/utility.txx | 27 |
1 files changed, 17 insertions, 10 deletions
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 <typename T> 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<T> (std::cin, "stdin", what, ignore_unknown); + return parse_manifest<T> (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<T> (ifs, f.string (), what, fh, iu); + } - ifdstream ifs (f); - return parse_manifest<T> (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 <typename T> @@ -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) { |