From 73546642ff887b0a887d00ac43395afde99577b3 Mon Sep 17 00:00:00 2001 From: Boris Kolpackov Date: Fri, 12 May 2017 16:11:48 +0200 Subject: Do soft/hard fail properly --- bbot/diagnostics.hxx | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 'bbot/diagnostics.hxx') diff --git a/bbot/diagnostics.hxx b/bbot/diagnostics.hxx index bfeeb2a..36a3cf2 100644 --- a/bbot/diagnostics.hxx +++ b/bbot/diagnostics.hxx @@ -129,6 +129,19 @@ namespace bbot r.flush (); throw failed (); }) {} + + // If hard is false, then we fail as an error (but still throw). + // + simple_prologue + operator() (bool hard = true) const + { + if (hard) + return simple_prologue (indent_, epilogue_, type_, name_); + + simple_prologue r (error ()); + r.epilogue = epilogue_; + return r; + } }; using fail_mark = butl::diag_mark; -- cgit v1.1