diff --git a/applications/test/PDRblockMesh/Test-PDRblockMesh.C b/applications/test/PDRblockMesh/Test-PDRblockMesh.C index cbbf7031253adf6d5ea33fd7269855c69c1c39d7..02b0ccbf6a90a2427a3d20194cff644b2a16a420 100644 --- a/applications/test/PDRblockMesh/Test-PDRblockMesh.C +++ b/applications/test/PDRblockMesh/Test-PDRblockMesh.C @@ -5,7 +5,7 @@ \\ / A nd | www.openfoam.com \\/ M anipulation | ------------------------------------------------------------------------------- - Copyright (C) 2019-2020 OpenCFD Ltd. + Copyright (C) 2019-2021 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -180,7 +180,7 @@ int main(int argc, char *argv[]) // Fatal with FULLDEBUG { - const bool throwingError = FatalError.throwExceptions(); + const bool oldThrowingError = FatalError.throwing(true); const label nx = mesh.sizes().x(); const label ny = mesh.sizes().y(); @@ -230,7 +230,7 @@ int main(int argc, char *argv[]) << err.message().c_str() << nl; } - FatalError.throwExceptions(throwingError); + FatalError.throwing(oldThrowingError); } diff --git a/applications/test/PackedList1/Test-PackedList1.C b/applications/test/PackedList1/Test-PackedList1.C index 7d3f92adf19713e1b416088e3219dfc99170f88e..812a82b81157b6daea65b08da6502cd41007f8b8 100644 --- a/applications/test/PackedList1/Test-PackedList1.C +++ b/applications/test/PackedList1/Test-PackedList1.C @@ -6,6 +6,7 @@ \\/ M anipulation | ------------------------------------------------------------------------------- Copyright (C) 2011-2016 OpenFOAM Foundation + Copyright (C) 2018-2021 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -171,7 +172,7 @@ int main(int argc, char *argv[]) Info<< "\ntest operator[] non-const with out-of-range index\n"; // Expect failure - const bool throwingError = FatalError.throwExceptions(); + const bool oldThrowingError = FatalError.throwing(true); try { @@ -190,7 +191,7 @@ int main(int argc, char *argv[]) Info<< "Failed (expected) " << err << nl << endl; } - FatalError.throwExceptions(throwingError); + FatalError.throwing(oldThrowingError); report(list1); } @@ -198,7 +199,7 @@ int main(int argc, char *argv[]) Info<< "\ntest operator[] with out-of-range index\n"; // Expect failure - const bool throwingError = FatalError.throwExceptions(); + const bool oldThrowingError = FatalError.throwing(true); try { @@ -212,7 +213,7 @@ int main(int argc, char *argv[]) Info<< "Failed (expected) " << err << nl << endl; } - FatalError.throwExceptions(throwingError); + FatalError.throwing(oldThrowingError); report(list1); } @@ -268,7 +269,7 @@ int main(int argc, char *argv[]) // Expect failure { - const bool throwingError = FatalError.throwExceptions(); + const bool oldThrowingError = FatalError.throwing(true); Info<< "\ntest operator[] assignment with auto-vivify\n"; @@ -286,7 +287,7 @@ int main(int argc, char *argv[]) list1.set(36, list1.max_value); } - FatalError.throwExceptions(throwingError); + FatalError.throwing(oldThrowingError); report(list1); } diff --git a/applications/test/Random/Test-Random.C b/applications/test/Random/Test-Random.C index 75b286755cff6309f5cb6589bba82f5f81b28591..7ff308cf8a8b6ca1166c7c138ce5802c1da1f8e0 100644 --- a/applications/test/Random/Test-Random.C +++ b/applications/test/Random/Test-Random.C @@ -5,7 +5,7 @@ \\ / A nd | www.openfoam.com \\/ M anipulation | ------------------------------------------------------------------------------- - Copyright (C) 2018-2019 OpenCFD Ltd. + Copyright (C) 2018-2021 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -271,7 +271,7 @@ int main(int argc, char *argv[]) // This should fail (in FULLDEBUG) - const bool throwingError = FatalError.throwExceptions(); + const bool oldThrowingError = FatalError.throwing(true); try { Info<<"Random position(10,5): " @@ -282,7 +282,7 @@ int main(int argc, char *argv[]) Info<< "Caught FatalError " << err << nl << endl; } - FatalError.throwExceptions(throwingError); + FatalError.throwing(oldThrowingError); Info<< "\nDone" << nl << endl; diff --git a/applications/test/argList/Test-argList.C b/applications/test/argList/Test-argList.C index 4ecc8859f52d85314269718abeb798c8426d52f8..bab02975005942b258b9acb3f82198ae8eaa7332 100644 --- a/applications/test/argList/Test-argList.C +++ b/applications/test/argList/Test-argList.C @@ -5,7 +5,7 @@ \\ / A nd | www.openfoam.com \\/ M anipulation | ------------------------------------------------------------------------------- - Copyright (C) 2017-2020 OpenCFD Ltd. + Copyright (C) 2017-2021 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -40,7 +40,7 @@ void predicateTests_label(const word& optName, const argList& args) { Info<< "predicate tests for " << optName << nl; - const bool throwingError = FatalError.throwExceptions(); + const bool oldThrowingError = FatalError.throwing(true); try { label val; @@ -52,7 +52,7 @@ void predicateTests_label(const word& optName, const argList& args) << err << nl << endl; } - FatalError.throwExceptions(throwingError); + FatalError.throwing(oldThrowingError); } @@ -60,7 +60,7 @@ void predicateTests_scalar(const word& optName, const argList& args) { Info<< "predicate tests for " << optName << nl; - const bool throwingError = FatalError.throwExceptions(); + const bool oldThrowingError = FatalError.throwing(true); try { scalar val; @@ -72,7 +72,7 @@ void predicateTests_scalar(const word& optName, const argList& args) << err << nl << endl; } - FatalError.throwExceptions(throwingError); + FatalError.throwing(oldThrowingError); } diff --git a/applications/test/coordinateSystem/Test-coordinateSystem.C b/applications/test/coordinateSystem/Test-coordinateSystem.C index f012bff2ee49c23ef22549901c5c9136913b074c..174389b6c62a2973bc76ddaab5a78441a2aeff31 100644 --- a/applications/test/coordinateSystem/Test-coordinateSystem.C +++ b/applications/test/coordinateSystem/Test-coordinateSystem.C @@ -101,8 +101,8 @@ void doTest(const dictionary& dict) Info<< dict.dictName() << dict << nl; // Could fail? - const bool throwingIOError = FatalIOError.throwExceptions(); - const bool throwingError = FatalError.throwExceptions(); + const bool oldThrowingError = FatalError.throwing(true); + const bool oldThrowingIOErr = FatalIOError.throwing(true); try { @@ -120,8 +120,8 @@ void doTest(const dictionary& dict) { Info<< "Caught FatalError " << err << nl << endl; } - FatalError.throwExceptions(throwingError); - FatalIOError.throwExceptions(throwingIOError); + FatalError.throwing(oldThrowingError); + FatalIOError.throwing(oldThrowingIOErr); } @@ -130,8 +130,8 @@ void doTest(const objectRegistry& obr, const dictionary& dict) Info<< dict.dictName() << dict << nl; // Could fail? - const bool throwingIOError = FatalIOError.throwExceptions(); - const bool throwingError = FatalError.throwExceptions(); + const bool oldThrowingError = FatalError.throwing(true); + const bool oldThrowingIOErr = FatalIOError.throwing(true); try { @@ -148,8 +148,8 @@ void doTest(const objectRegistry& obr, const dictionary& dict) { Info<< "Caught FatalError " << err << nl << endl; } - FatalError.throwExceptions(throwingError); - FatalIOError.throwExceptions(throwingIOError); + FatalError.throwing(oldThrowingError); + FatalIOError.throwing(oldThrowingIOErr); } diff --git a/applications/test/dictionary2/Test-dictionary2.C b/applications/test/dictionary2/Test-dictionary2.C index a3eaa6de419ef8295d55b082e7d26c27cd065a1f..165bdf0726ed39190b8ca3a3e13e88e64259d658 100644 --- a/applications/test/dictionary2/Test-dictionary2.C +++ b/applications/test/dictionary2/Test-dictionary2.C @@ -5,7 +5,7 @@ \\ / A nd | www.openfoam.com \\/ M anipulation | ------------------------------------------------------------------------------- - Copyright (C) 2017-2020 OpenCFD Ltd. + Copyright (C) 2017-2021 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -57,8 +57,8 @@ scalar try_readScalar(const dictionary& dict, const word& k) { scalar val(-GREAT); - const bool throwingIOError = FatalIOError.throwExceptions(); - const bool throwingError = FatalError.throwExceptions(); + const bool oldThrowingError = FatalError.throwing(true); + const bool oldThrowingIOerr = FatalIOError.throwing(true); try { @@ -75,8 +75,8 @@ scalar try_readScalar(const dictionary& dict, const word& k) Info<< "readScalar(" << k << ") Caught FatalError " << err << nl << endl; } - FatalError.throwExceptions(throwingError); - FatalIOError.throwExceptions(throwingIOError); + FatalError.throwing(oldThrowingError); + FatalIOError.throwing(oldThrowingIOerr); return val; } @@ -87,8 +87,8 @@ scalar try_getScalar(const dictionary& dict, const word& k) { scalar val(-GREAT); - const bool throwingIOError = FatalIOError.throwExceptions(); - const bool throwingError = FatalError.throwExceptions(); + const bool oldThrowingError = FatalError.throwing(true); + const bool oldThrowingIOerr = FatalIOError.throwing(true); try { @@ -105,8 +105,8 @@ scalar try_getScalar(const dictionary& dict, const word& k) Info<< "get<scalar>(" << k << ") Caught FatalError " << err << nl << endl; } - FatalError.throwExceptions(throwingError); - FatalIOError.throwExceptions(throwingIOError); + FatalError.throwing(oldThrowingError); + FatalIOError.throwing(oldThrowingIOerr); return val; } @@ -123,8 +123,8 @@ scalar try_getCheckScalar { scalar val(-GREAT); - const bool throwingIOError = FatalIOError.throwExceptions(); - const bool throwingError = FatalError.throwExceptions(); + const bool oldThrowingError = FatalError.throwing(true); + const bool oldThrowingIOerr = FatalIOError.throwing(true); try { @@ -141,8 +141,8 @@ scalar try_getCheckScalar Info<< "getCheck<scalar>(" << k << ") Caught FatalError " << err << nl << endl; } - FatalError.throwExceptions(throwingError); - FatalIOError.throwExceptions(throwingIOError); + FatalError.throwing(oldThrowingError); + FatalIOError.throwing(oldThrowingIOerr); return val; } @@ -159,8 +159,8 @@ scalar try_getScalar(const entry* eptr, const word& k) return val; } - const bool throwingIOError = FatalIOError.throwExceptions(); - const bool throwingError = FatalError.throwExceptions(); + const bool oldThrowingError = FatalError.throwing(true); + const bool oldThrowingIOerr = FatalIOError.throwing(true); try { @@ -177,8 +177,8 @@ scalar try_getScalar(const entry* eptr, const word& k) Info<< "entry get<scalar>(" << k << ") Caught FatalError " << err << nl << endl; } - FatalError.throwExceptions(throwingError); - FatalIOError.throwExceptions(throwingIOError); + FatalError.throwing(oldThrowingError); + FatalIOError.throwing(oldThrowingIOerr); return val; } diff --git a/applications/test/dimensionSet/Test-dimensionSet.C b/applications/test/dimensionSet/Test-dimensionSet.C index b145927c254317733ae937800c43162f3b4cd404..52374f0e40064227de26e9f347ec261432b23513 100644 --- a/applications/test/dimensionSet/Test-dimensionSet.C +++ b/applications/test/dimensionSet/Test-dimensionSet.C @@ -5,7 +5,7 @@ \\ / A nd | www.openfoam.com \\/ M anipulation | ------------------------------------------------------------------------------- - Copyright (C) 2018 OpenCFD Ltd. + Copyright (C) 2018-2021 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -94,7 +94,7 @@ unsigned checkDimensions std::string errMsg; // Expect some failures - const bool prev = FatalError.throwExceptions(); + const bool oldThrowingError = FatalError.throwing(true); for ( @@ -127,7 +127,7 @@ unsigned checkDimensions hadDimensionError(test, dimsOk, errMsg); } - FatalError.throwExceptions(prev); + FatalError.throwing(oldThrowingError); return nFail; } diff --git a/applications/test/error/Test-error.C b/applications/test/error/Test-error.C index 3e25fe9da0bbe6c3e502f0c7f98b8dbe127f9e67..2fe8f95a99d9a0e5307c93b9b32640d6af9ae0ab 100644 --- a/applications/test/error/Test-error.C +++ b/applications/test/error/Test-error.C @@ -56,8 +56,8 @@ int main(int argc, char *argv[]) if (!args.found("no-throw")) { - FatalIOError.throwExceptions(); - FatalError.throwExceptions(); + FatalIOError.throwing(true); + FatalError.throwing(true); } try diff --git a/applications/test/exprEntry/Test-exprEntry.C b/applications/test/exprEntry/Test-exprEntry.C index 1f14bbf45aa65f55c218bd8a1aded1036fdf01a4..b2a0dffb55ce337e277138c9d04ea841774b2e3a 100644 --- a/applications/test/exprEntry/Test-exprEntry.C +++ b/applications/test/exprEntry/Test-exprEntry.C @@ -103,8 +103,8 @@ int main(int argc, char *argv[]) { string str(t.stringToken()); - const bool throwingErr = FatalError.throwExceptions(); - const bool throwingIOErr = FatalIOError.throwExceptions(); + const bool oldThrowingError = FatalError.throwing(true); + const bool oldThrowingIOErr = FatalIOError.throwing(true); try { @@ -128,8 +128,8 @@ int main(int argc, char *argv[]) Info<< err.message().c_str() << nl; } - FatalError.throwExceptions(throwingErr); - FatalIOError.throwExceptions(throwingIOErr); + FatalError.throwing(oldThrowingError); + FatalIOError.throwing(oldThrowingIOErr); Info<< nl; } } diff --git a/applications/test/faces/Test-faces.C b/applications/test/faces/Test-faces.C index 7909cac61b65b79cf86f0909e13854bbc0127125..fab3d04ca15fcecd0f68ad42ebeeb85e9fea1f34 100644 --- a/applications/test/faces/Test-faces.C +++ b/applications/test/faces/Test-faces.C @@ -148,7 +148,7 @@ int main(int argc, char *argv[]) #if 0 // Expect failure, but triggers abort which cannot be caught - const bool throwingError = FatalError.throwExceptions(); + const bool oldThrowingError = FatalError.throwing(true); try { labelledTri l1({1, 2, 3, 10, 24}); @@ -159,7 +159,7 @@ int main(int argc, char *argv[]) WarningInFunction << "Caught FatalError " << err << nl << endl; } - FatalError.throwExceptions(throwingError); + FatalError.throwing(oldThrowingError); #endif labelledTri l2({1, 2, 3}); diff --git a/applications/test/fileName/Test-fileName.C b/applications/test/fileName/Test-fileName.C index 64888aa1097b599be21978cf626e152962258b4b..8a1568e4a4677f35ac9fb6910f1554759e6f43b8 100644 --- a/applications/test/fileName/Test-fileName.C +++ b/applications/test/fileName/Test-fileName.C @@ -779,7 +779,7 @@ int main(int argc, char *argv[]) Info<< nl << "Expect a FatalError for findEtcFile() with a bad name:" << nl; - const bool throwingError = FatalError.throwExceptions(); + const bool oldThrowingError = FatalError.throwing(true); try { @@ -792,7 +792,7 @@ int main(int argc, char *argv[]) Info<< nl << "findEtcFile() Caught FatalError " << err << nl << endl; } - FatalError.throwExceptions(throwingError); + FatalError.throwing(oldThrowingError); } diff --git a/applications/test/primitives/Test-primitives.C b/applications/test/primitives/Test-primitives.C index 1fe56e2ae9f7896ec41b634ae469c687f482cae4..0eb6a0711037597dba7b3507d64e03ca819d7737 100644 --- a/applications/test/primitives/Test-primitives.C +++ b/applications/test/primitives/Test-primitives.C @@ -144,8 +144,8 @@ unsigned testParsing string errMsg; // Expect some failures - const bool prev1 = FatalError.throwExceptions(); - const bool prev2 = FatalIOError.throwExceptions(); + const bool oldThrowingError = FatalError.throwing(true); + const bool oldThrowingIOErr = FatalIOError.throwing(true); for (const std::pair<bool, std::string>& test : tests) { @@ -169,8 +169,8 @@ unsigned testParsing hadParsingError(test, result, errMsg); } - FatalError.throwExceptions(prev1); - FatalIOError.throwExceptions(prev2); + FatalError.throwing(oldThrowingError); + FatalIOError.throwing(oldThrowingIOErr); return nFail; } diff --git a/applications/test/regex1/Test-regex1.C b/applications/test/regex1/Test-regex1.C index 9f917355a96e58b44f8c7822cf1e319b26469969..921b3aa130ca23839c0f6ba2975229f98193098e 100644 --- a/applications/test/regex1/Test-regex1.C +++ b/applications/test/regex1/Test-regex1.C @@ -110,7 +110,7 @@ void generalTests() string me("Mark"); // Expect some failures: - const bool throwingError = FatalError.throwExceptions(); + const bool oldThrowingError = FatalError.throwing(true); try { @@ -214,7 +214,7 @@ void generalTests() Info<< "Caught FatalError " << err << nl << endl; } - FatalError.throwExceptions(throwingError); + FatalError.throwing(oldThrowingError); } @@ -224,7 +224,7 @@ void testExpressions(const UList<regexTest>& tests) typename RegexType::results_type match; // Expect some failures: - const bool throwingError = FatalError.throwExceptions(); + const bool oldThrowingError = FatalError.throwing(true); // Report matches: for (const auto& testseq : tests) @@ -282,7 +282,7 @@ void testExpressions(const UList<regexTest>& tests) } } - FatalError.throwExceptions(throwingError); + FatalError.throwing(oldThrowingError); } diff --git a/applications/test/string2/Test-string2.C b/applications/test/string2/Test-string2.C index 65368a06705c32c50caf600673976551201117ef..9186bda26f27086fb219cef2fd5c3cd7c8956e5b 100644 --- a/applications/test/string2/Test-string2.C +++ b/applications/test/string2/Test-string2.C @@ -5,7 +5,7 @@ \\ / A nd | www.openfoam.com \\/ M anipulation | ------------------------------------------------------------------------------- - Copyright (C) 2019 OpenCFD Ltd. + Copyright (C) 2019-2021 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -66,7 +66,7 @@ void testNumericEvaluation(const std::string& s) << s << nl << "========" << nl; - const bool throwingIOError = FatalIOError.throwExceptions(); + const bool oldThrowingIOErr = FatalIOError.throwing(true); try { @@ -91,7 +91,7 @@ void testNumericEvaluation(const std::string& s) Info<< "========" << nl << nl; - FatalIOError.throwExceptions(throwingIOError); + FatalIOError.throwing(oldThrowingIOErr); } diff --git a/applications/utilities/mesh/manipulation/setSet/setSet.C b/applications/utilities/mesh/manipulation/setSet/setSet.C index b866b07cb25285fbed2eb3787e5ad54ac1a4dae2..7f90522630061743a87778721e52362c968bc3e2 100644 --- a/applications/utilities/mesh/manipulation/setSet/setSet.C +++ b/applications/utilities/mesh/manipulation/setSet/setSet.C @@ -813,8 +813,8 @@ int main(int argc, char *argv[]) // Whether to quit bool quit = false; - FatalError.throwExceptions(); - FatalIOError.throwExceptions(); + FatalError.throwing(true); + FatalIOError.throwing(true); do { diff --git a/applications/utilities/miscellaneous/foamHelp/foamHelp.C b/applications/utilities/miscellaneous/foamHelp/foamHelp.C index e95f0853a5a26d6a26d6f795b590700dfa6de11a..99ce193b5ca6563aab6bcf67814fbeb3cc1b573a 100644 --- a/applications/utilities/miscellaneous/foamHelp/foamHelp.C +++ b/applications/utilities/miscellaneous/foamHelp/foamHelp.C @@ -6,7 +6,7 @@ \\/ M anipulation | ------------------------------------------------------------------------------- Copyright (C) 2012-2014 OpenFOAM Foundation - Copyright (C) 2017 OpenCFD Ltd. + Copyright (C) 2017-2021 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -63,7 +63,7 @@ int main(int argc, char *argv[]) word utilityName(argv[1]); autoPtr<helpType> utility; - const bool throwing = FatalError.throwExceptions(); + const bool oldThrowingErr = FatalError.throwing(true); try { utility.reset(helpType::New(utilityName)); @@ -76,7 +76,7 @@ int main(int argc, char *argv[]) << err.message().c_str() << nl << exit(FatalError); } - FatalError.throwExceptions(throwing); + FatalError.throwing(oldThrowingErr); utility().init(); diff --git a/applications/utilities/miscellaneous/foamHelp/helpTypes/helpBoundary/helpBoundaryTemplates.C b/applications/utilities/miscellaneous/foamHelp/helpTypes/helpBoundary/helpBoundaryTemplates.C index 9721c55ea6501ad57c73409c89ac184d56df47bb..43fa15d7920859adb4c10a90baa4b504873645f7 100644 --- a/applications/utilities/miscellaneous/foamHelp/helpTypes/helpBoundary/helpBoundaryTemplates.C +++ b/applications/utilities/miscellaneous/foamHelp/helpTypes/helpBoundary/helpBoundaryTemplates.C @@ -105,8 +105,8 @@ void Foam::helpTypes::helpBoundary::fixedValueFieldConditions // throw exceptions to avoid fatal errors when casting from generic patch // type to incompatible patch type - FatalIOError.throwExceptions(); - FatalError.throwExceptions(); + FatalIOError.throwing(true); + FatalError.throwing(true); bool foundFixed = false; forAll(types, i) diff --git a/applications/utilities/postProcessing/dataConversion/foamToEnsight/createMeshAccounting.H b/applications/utilities/postProcessing/dataConversion/foamToEnsight/createMeshAccounting.H index 61116489eecd3566665b4962f56dfe727f32e0cb..909d3dfedf0c6d8b7427da564bcedc7a932e6da2 100644 --- a/applications/utilities/postProcessing/dataConversion/foamToEnsight/createMeshAccounting.H +++ b/applications/utilities/postProcessing/dataConversion/foamToEnsight/createMeshAccounting.H @@ -67,7 +67,7 @@ PtrList<ensightFaMesh> ensightMeshesFa(regionNames.size()); { autoPtr<faMesh> faMeshPtr; - const bool throwing = FatalError.throwExceptions(); + const bool oldThrowingError = FatalError.throwing(true); try { faMeshPtr.reset(new faMesh(mesh)); @@ -76,7 +76,7 @@ PtrList<ensightFaMesh> ensightMeshesFa(regionNames.size()); { faMeshPtr.reset(nullptr); } - FatalError.throwExceptions(throwing); + FatalError.throwing(oldThrowingError); if (faMeshPtr) { diff --git a/applications/utilities/postProcessing/dataConversion/foamToVTK/convertAreaFields.H b/applications/utilities/postProcessing/dataConversion/foamToVTK/convertAreaFields.H index 9f4b8fc68451b21f5c8c0f490c52c7aeb239b9e6..f9f15fb4828629e2ceb3587e97db771e35fd3cb2 100644 --- a/applications/utilities/postProcessing/dataConversion/foamToVTK/convertAreaFields.H +++ b/applications/utilities/postProcessing/dataConversion/foamToVTK/convertAreaFields.H @@ -46,7 +46,7 @@ if (doFiniteArea) if (nAreaFields) { - const bool throwing = FatalError.throwExceptions(); + const bool oldThrowingError = FatalError.throwing(true); try { faMeshPtr.reset(new faMesh(meshProxy.baseMesh())); @@ -55,7 +55,7 @@ if (doFiniteArea) { faMeshPtr.clear(); } - FatalError.throwExceptions(throwing); + FatalError.throwing(oldThrowingError); } if (faMeshPtr && nAreaFields) diff --git a/applications/utilities/postProcessing/postProcess/postProcess.C b/applications/utilities/postProcessing/postProcess/postProcess.C index d2d03fcb81786b4ae950828e5deb51fd9f4d4b72..1071cec35d2f5c5aee7a28c88134eb13eff7ff11 100644 --- a/applications/utilities/postProcessing/postProcess/postProcess.C +++ b/applications/utilities/postProcessing/postProcess/postProcess.C @@ -6,7 +6,7 @@ \\/ M anipulation | ------------------------------------------------------------------------------- Copyright (C) 2016 OpenFOAM Foundation - Copyright (C) 2018-2019 OpenCFD Ltd. + Copyright (C) 2018-2021 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -233,7 +233,7 @@ int main(int argc, char *argv[]) fields.updateSelection(); - const bool throwingIOErr = FatalIOError.throwExceptions(); + const bool oldThrowingIOErr = FatalIOError.throwing(true); try { @@ -258,7 +258,7 @@ int main(int argc, char *argv[]) Info<< endl; // Restore previous exception throwing state - FatalIOError.throwExceptions(throwingIOErr); + FatalIOError.throwing(oldThrowingIOErr); } Info<< "End\n" << endl; diff --git a/src/OpenFOAM/db/IOobjectList/IOobjectList.C b/src/OpenFOAM/db/IOobjectList/IOobjectList.C index 85439ec787beba3f28045d8a4d208524fa51f8a8..3772b23ac067a8ccabffcd6756ccc7beeecc092b 100644 --- a/src/OpenFOAM/db/IOobjectList/IOobjectList.C +++ b/src/OpenFOAM/db/IOobjectList/IOobjectList.C @@ -6,7 +6,7 @@ \\/ M anipulation | ------------------------------------------------------------------------------- Copyright (C) 2011-2017 OpenFOAM Foundation - Copyright (C) 2016-2020 OpenCFD Ltd. + Copyright (C) 2016-2021 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -137,7 +137,7 @@ Foam::IOobjectList::IOobjectList ); bool ok = false; - const bool throwingIOerr = FatalIOError.throwExceptions(); + const bool oldThrowingIOerr = FatalIOError.throwing(true); try { @@ -149,7 +149,7 @@ Foam::IOobjectList::IOobjectList Warning << err << nl << endl; } - FatalIOError.throwExceptions(throwingIOerr); + FatalIOError.throwing(oldThrowingIOerr); if (ok) { diff --git a/src/OpenFOAM/db/error/error.H b/src/OpenFOAM/db/error/error.H index e7ecf16fbf4d378a7269665b09832f0a0c5e85f5..2bd569e7eefff910ef64ecb8e1a7b0c0ee22bb86 100644 --- a/src/OpenFOAM/db/error/error.H +++ b/src/OpenFOAM/db/error/error.H @@ -159,12 +159,12 @@ public: return throwing_; } - //- Specify exception throwing (default is activate) + //- Specify exception throwing state (on or off) // \return the previous throwing state - bool throwExceptions(bool doThrow = true) noexcept + bool throwing(const bool on) noexcept { - bool old = throwing_; - throwing_ = doThrow; + bool old(throwing_); + throwing_ = on; return old; } @@ -230,6 +230,13 @@ public: // Housekeeping + //- Specify exception throwing state (default is \b on) + // \return the previous throwing state + bool throwExceptions(const bool on = true) noexcept + { + return throwing(on); + } + //- Deactivate exception throwing // \return the previous throwing state bool dontThrowExceptions() noexcept diff --git a/src/OpenFOAM/db/functionObjects/functionObjectList/functionObjectList.C b/src/OpenFOAM/db/functionObjects/functionObjectList/functionObjectList.C index 1c7f5a918651229d7cff62ba36921509bedfdd29..4c39aa2759bacb7cb71eee917308dfa29461cdfa 100644 --- a/src/OpenFOAM/db/functionObjects/functionObjectList/functionObjectList.C +++ b/src/OpenFOAM/db/functionObjects/functionObjectList/functionObjectList.C @@ -647,8 +647,8 @@ bool Foam::functionObjectList::execute() { // Throw FatalError, FatalIOError as exceptions - const bool throwingError = FatalError.throwExceptions(); - const bool throwingIOerr = FatalIOError.throwExceptions(); + const bool oldThrowingError = FatalError.throwing(true); + const bool oldThrowingIOerr = FatalIOError.throwing(true); bool hadError = false; @@ -693,8 +693,8 @@ bool Foam::functionObjectList::execute() if (hadError) { // Restore previous state - FatalError.throwExceptions(throwingError); - FatalIOError.throwExceptions(throwingIOerr); + FatalError.throwing(oldThrowingError); + FatalIOError.throwing(oldThrowingIOerr); continue; } @@ -736,8 +736,8 @@ bool Foam::functionObjectList::execute() } // Restore previous state - FatalError.throwExceptions(throwingError); - FatalIOError.throwExceptions(throwingIOerr); + FatalError.throwing(oldThrowingError); + FatalIOError.throwing(oldThrowingIOerr); } else { @@ -853,8 +853,8 @@ bool Foam::functionObjectList::end() // Ignore failure on end() - not much we can do anyhow // Throw FatalError, FatalIOError as exceptions - const bool throwingError = FatalError.throwExceptions(); - const bool throwingIOerr = FatalIOError.throwExceptions(); + const bool oldThrowingError = FatalError.throwing(true); + const bool oldThrowingIOerr = FatalIOError.throwing(true); try { @@ -888,8 +888,8 @@ bool Foam::functionObjectList::end() } // Restore previous state - FatalError.throwExceptions(throwingError); - FatalIOError.throwExceptions(throwingIOerr); + FatalError.throwing(oldThrowingError); + FatalIOError.throwing(oldThrowingIOerr); } } @@ -1083,8 +1083,8 @@ bool Foam::functionObjectList::read() if (enabled && !objPtr) { // Throw FatalError, FatalIOError as exceptions - const bool throwingError = FatalError.throwExceptions(); - const bool throwingIOerr = FatalIOError.throwExceptions(); + const bool oldThrowingError = FatalError.throwing(true); + const bool oldThrowingIOerr = FatalIOError.throwing(true); try { @@ -1148,8 +1148,8 @@ bool Foam::functionObjectList::read() } // Restore previous state - FatalError.throwExceptions(throwingError); - FatalIOError.throwExceptions(throwingIOerr); + FatalError.throwing(oldThrowingError); + FatalIOError.throwing(oldThrowingIOerr); // Require valid functionObject on all processors if (!returnReduce(bool(objPtr), andOp<bool>())) diff --git a/src/OpenFOAM/db/functionObjects/functionObjectList/postProcess.H b/src/OpenFOAM/db/functionObjects/functionObjectList/postProcess.H index 2d9b730788022f59b2b8ece246644212f3ef197a..a42521f5b27f07a7bb0aa3204948a8751c6a6c5d 100644 --- a/src/OpenFOAM/db/functionObjects/functionObjectList/postProcess.H +++ b/src/OpenFOAM/db/functionObjects/functionObjectList/postProcess.H @@ -140,7 +140,7 @@ if (argList::postProcess(argc, argv)) } } - FatalIOError.throwExceptions(); + FatalIOError.throwing(true); try { diff --git a/tutorials/incompressible/lumpedPointMotion/bridge/code/polynomial-motion.C b/tutorials/incompressible/lumpedPointMotion/bridge/code/polynomial-motion.C index f6280dd0de9f9147333c2172b4fb924c8c9b3349..c15a39f067a4a67b6950deebcd9a616fc0fa0d55 100644 --- a/tutorials/incompressible/lumpedPointMotion/bridge/code/polynomial-motion.C +++ b/tutorials/incompressible/lumpedPointMotion/bridge/code/polynomial-motion.C @@ -5,7 +5,7 @@ \\ / A nd | www.openfoam.com \\/ M anipulation | ------------------------------------------------------------------------------- - Copyright (C) 2020 OpenCFD Ltd. + Copyright (C) 2020-2021 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -362,8 +362,8 @@ int main(int argc, char *argv[]) autoPtr<Time> runTimePtr; autoPtr<lumpedPointIOMovement> movementPtr; - const bool throwingIOError = FatalIOError.throwExceptions(); - const bool throwingError = FatalError.throwExceptions(); + const bool oldThrowingError = FatalError.throwing(true); + const bool oldThrowingIOerr = FatalIOError.throwing(true); try { @@ -380,8 +380,8 @@ int main(int argc, char *argv[]) } Info<< nl << endl; - FatalError.throwExceptions(throwingError); - FatalIOError.throwExceptions(throwingIOError); + FatalError.throwing(oldThrowingError); + FatalIOError.throwing(oldThrowingIOerr); if (!movementPtr) { diff --git a/tutorials/incompressible/lumpedPointMotion/building/code/building-motion.C b/tutorials/incompressible/lumpedPointMotion/building/code/building-motion.C index 14de04b9ed333a7f61a81d0a5fa4634abf01c10b..1e4c5c77a949e0042f0fc1e3404efee9b829d656 100644 --- a/tutorials/incompressible/lumpedPointMotion/building/code/building-motion.C +++ b/tutorials/incompressible/lumpedPointMotion/building/code/building-motion.C @@ -408,8 +408,8 @@ int main(int argc, char *argv[]) autoPtr<Time> runTimePtr; autoPtr<lumpedPointIOMovement> movementPtr; - const bool throwingIOError = FatalIOError.throwExceptions(); - const bool throwingError = FatalError.throwExceptions(); + const bool oldThrowingIO = FatalIOError.throwing(true); + const bool oldThrowingEx = FatalError.throwing(true); try { @@ -426,8 +426,8 @@ int main(int argc, char *argv[]) } Info<< nl << endl; - FatalError.throwExceptions(throwingError); - FatalIOError.throwExceptions(throwingIOError); + FatalError.throwing(oldThrowingEx); + FatalIOError.throwing(oldThrowingIO); if (!movementPtr) {