ENH: use consistent naming when toggling exception throwing on/off
This commit is contained in:
parent
fddf8a8832
commit
851be8ea33
@ -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);
|
||||
}
|
||||
|
||||
|
||||
|
@ -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);
|
||||
}
|
||||
|
||||
|
@ -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;
|
||||
|
||||
|
@ -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);
|
||||
}
|
||||
|
||||
|
||||
|
@ -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);
|
||||
}
|
||||
|
||||
|
||||
|
@ -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;
|
||||
}
|
||||
|
@ -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;
|
||||
}
|
||||
|
@ -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
|
||||
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
@ -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});
|
||||
|
@ -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);
|
||||
}
|
||||
|
||||
|
||||
|
@ -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;
|
||||
}
|
||||
|
@ -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);
|
||||
}
|
||||
|
||||
|
||||
|
@ -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);
|
||||
}
|
||||
|
||||
|
||||
|
@ -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
|
||||
{
|
||||
|
@ -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();
|
||||
|
||||
|
@ -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)
|
||||
|
@ -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)
|
||||
{
|
||||
|
@ -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)
|
||||
|
@ -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;
|
||||
|
@ -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)
|
||||
{
|
||||
|
@ -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
|
||||
|
@ -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>()))
|
||||
|
@ -140,7 +140,7 @@ if (argList::postProcess(argc, argv))
|
||||
}
|
||||
}
|
||||
|
||||
FatalIOError.throwExceptions();
|
||||
FatalIOError.throwing(true);
|
||||
|
||||
try
|
||||
{
|
||||
|
@ -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)
|
||||
{
|
||||
|
@ -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)
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user