mirror of
https://develop.openfoam.com/Development/openfoam.git
synced 2025-12-28 03:37:59 +00:00
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:
@ -52,7 +52,7 @@ int main(int argc, char *argv[])
|
||||
Info<< "face:" << f1 << nl;
|
||||
|
||||
// expect these to fail
|
||||
FatalError.throwExceptions();
|
||||
const bool throwingError = FatalError.throwExceptions();
|
||||
try
|
||||
{
|
||||
labelledTri l1{ 1, 2, 3, 10, 24 };
|
||||
@ -63,7 +63,7 @@ int main(int argc, char *argv[])
|
||||
WarningInFunction
|
||||
<< "Caught FatalError " << err << nl << endl;
|
||||
}
|
||||
FatalError.dontThrowExceptions();
|
||||
FatalError.throwExceptions(throwingError);
|
||||
|
||||
labelledTri l2{ 1, 2, 3 };
|
||||
Info<< "labelled:" << l2 << nl;
|
||||
|
||||
Reference in New Issue
Block a user