diff options
-rw-r--r-- | bbot/agent.cxx | 9 | ||||
-rw-r--r-- | bbot/utility.hxx | 5 | ||||
-rw-r--r-- | bbot/utility.txx | 27 |
3 files changed, 29 insertions, 12 deletions
diff --git a/bbot/agent.cxx b/bbot/agent.cxx index 671f1c0..b2d09d1 100644 --- a/bbot/agent.cxx +++ b/bbot/agent.cxx @@ -691,7 +691,14 @@ try // Parse the result manifest. // - r = parse_manifest<result_manifest> (rf, "result"); + try + { + r = parse_manifest<result_manifest> (rf, "result", false); + } + catch (const failed&) + { + r.status = result_status::abnormal; // Soft-fail below. + } // If the build terminated abnormally, suspent the machine for // investigation (note that here we don't wait or return). diff --git a/bbot/utility.hxx b/bbot/utility.hxx index 73804a4..0506293 100644 --- a/bbot/utility.hxx +++ b/bbot/utility.hxx @@ -136,7 +136,10 @@ namespace bbot // template <typename T> T - parse_manifest (const path&, const char* what, bool ignore_unknown = true); + parse_manifest (const path&, + const char* what, + bool fail_hard = true, + bool ignore_unknown = true); template <typename T> T 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) { |