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

@ -191,7 +191,7 @@ int main(int argc, char *argv[])
);
}
FatalIOError.throwExceptions();
const bool throwingIOErr = FatalIOError.throwExceptions();
try
{
@ -208,12 +208,15 @@ int main(int argc, char *argv[])
// Report to output (avoid overwriting values from simulation)
profiling::print(Info);
}
catch (IOerror& err)
catch (Foam::IOerror& err)
{
Warning<< err << endl;
}
Info<< endl;
// Restore previous exception throwing state
FatalIOError.throwExceptions(throwingIOErr);
}
Info<< "End\n" << endl;