ENH: additional method for switching error throwing on/off (issue #552)

- error::throwExceptions(bool) returning the previous state makes it
  easier to set and restore states.

- throwing() method to query the current handling (if required).

- the normal error::throwExceptions() and error::dontThrowExceptions()
  also return the previous state, to make it easier to restore later.
This commit is contained in:
Mark Olesen
2017-07-29 12:25:30 +02:00
parent 41eafeb020
commit 797155f862
8 changed files with 105 additions and 62 deletions

View File

@ -90,8 +90,8 @@ Foam::OSstream& Foam::messageStream::operator()
{
OSstream& os = operator OSstream&();
os << endl
<< " From function " << functionName << endl
os << nl
<< " From function " << functionName << nl
<< " in file " << sourceFileName
<< " at line " << sourceFileLineNumber << endl
<< " ";
@ -194,7 +194,7 @@ Foam::messageStream::operator Foam::OSstream&()
{
if (level)
{
bool collect = (severity_ == INFO || severity_ == WARNING);
const bool collect = (severity_ == INFO || severity_ == WARNING);
// Report the error
if (!Pstream::master() && collect)