STYLE: use const reference for caught exceptions

This commit is contained in:
Mark Olesen
2019-01-23 09:03:06 +01:00
parent a50c446853
commit a5cc0ffcad
20 changed files with 54 additions and 55 deletions

View File

@ -183,7 +183,7 @@ int main(int argc, char *argv[])
<< "(non-const)\n";
}
}
catch (Foam::error& err)
catch (const Foam::error& err)
{
Info<< "Failed (expected) " << err << nl << endl;
}
@ -205,7 +205,7 @@ int main(int argc, char *argv[])
Info<< "[20] is false, as expected for const-access\n";
}
}
catch (Foam::error& err)
catch (const Foam::error& err)
{
Info<< "Failed (expected) " << err << nl << endl;
}
@ -275,7 +275,7 @@ int main(int argc, char *argv[])
list1[16] = 5;
list1[36] = list1.max_value;
}
catch (Foam::error& err)
catch (const Foam::error& err)
{
Info<< "Failed (expected) " << err << nl << endl;

View File

@ -201,7 +201,7 @@ int main(int argc, char *argv[])
Info<<"Random position(10,5): "
<< Random().position<label>(10, 5) << endl;
}
catch (Foam::error& err)
catch (const Foam::error& err)
{
Info<< "Caught FatalError " << err << nl << endl;
}

View File

@ -108,11 +108,11 @@ void doTest(const dictionary& dict)
basicTests(cs1);
}
catch (Foam::IOerror& err)
catch (const Foam::IOerror& err)
{
Info<< "Caught FatalIOError " << err << nl << endl;
}
catch (Foam::error& err)
catch (const Foam::error& err)
{
Info<< "Caught FatalError " << err << nl << endl;
}
@ -136,11 +136,11 @@ void doTest(const objectRegistry& obr, const dictionary& dict)
basicTests(cs1);
}
catch (Foam::IOerror& err)
catch (const Foam::IOerror& err)
{
Info<< "Caught FatalIOError " << err << nl << endl;
}
catch (Foam::error& err)
catch (const Foam::error& err)
{
Info<< "Caught FatalError " << err << nl << endl;
}

View File

@ -61,12 +61,12 @@ scalar try_readScalar(const dictionary& dict, const word& k)
val = readScalar(dict.lookup(k));
Info<< "readScalar(" << k << ") = " << val << nl;
}
catch (Foam::IOerror& err)
catch (const Foam::IOerror& err)
{
Info<< "readScalar(" << k << ") Caught FatalIOError "
<< err << nl << endl;
}
catch (Foam::error& err)
catch (const Foam::error& err)
{
Info<< "readScalar(" << k << ") Caught FatalError "
<< err << nl << endl;
@ -91,12 +91,12 @@ scalar try_getScalar(const dictionary& dict, const word& k)
val = dict.get<scalar>(k);
Info<< "get<scalar>(" << k << ") = " << val << nl;
}
catch (Foam::IOerror& err)
catch (const Foam::IOerror& err)
{
Info<< "get<scalar>(" << k << ") Caught FatalIOError "
<< err << nl << endl;
}
catch (Foam::error& err)
catch (const Foam::error& err)
{
Info<< "get<scalar>(" << k << ") Caught FatalError "
<< err << nl << endl;
@ -127,12 +127,12 @@ scalar try_getScalar(const entry* eptr, const word& k)
val = eptr->get<scalar>();
Info<< "entry get<scalar>(" << k << ") = " << val << nl;
}
catch (Foam::IOerror& err)
catch (const Foam::IOerror& err)
{
Info<< "entry get<scalar>(" << k << ") Caught FatalIOError "
<< err << nl << endl;
}
catch (Foam::error& err)
catch (const Foam::error& err)
{
Info<< "entry get<scalar>(" << k << ") Caught FatalError "
<< err << nl << endl;

View File

@ -112,7 +112,7 @@ unsigned checkDimensions
clip(a, b);
dimsOk = true;
}
catch (Foam::error& err)
catch (const Foam::error& err)
{
errMsg = err.message();
}

View File

@ -55,7 +55,7 @@ int main(int argc, char *argv[])
<< "Error 2"
<< exit(FatalError);
}
catch (Foam::error& fErr)
catch (const Foam::error& fErr)
{
Serr<< "Caught Foam error " << fErr << nl << endl;
}
@ -66,7 +66,7 @@ int main(int argc, char *argv[])
<< "Error# 3"
<< exit(FatalError);
}
catch (Foam::error& fErr)
catch (const Foam::error& fErr)
{
Serr<< "Caught Foam error " << fErr << nl << endl;
}

View File

@ -120,7 +120,7 @@ int main(int argc, char *argv[])
labelledTri l1{ 1, 2, 3, 10, 24 };
Info<< "labelled:" << l1 << nl;
}
catch (Foam::error& err)
catch (const Foam::error& err)
{
WarningInFunction
<< "Caught FatalError " << err << nl << endl;

View File

@ -783,7 +783,7 @@ int main(int argc, char *argv[])
<< findEtcFile("<very-badName>", true) << nl
<< endl;
}
catch (Foam::error& err)
catch (const Foam::error& err)
{
Info<< nl << "findEtcFile() Caught FatalError "
<< err << nl << endl;

View File

@ -107,7 +107,7 @@ unsigned testParsing
result.second = function (test.second);
result.first = true;
}
catch (Foam::error& err)
catch (const Foam::error& err)
{
errMsg = err.message();
}

View File

@ -127,7 +127,7 @@ int main(int argc, char *argv[])
}
Info<< endl;
}
catch (Foam::error& err)
catch (const Foam::error& err)
{
Info<< "Caught FatalError " << err << nl << endl;
continue;
@ -164,7 +164,7 @@ int main(int argc, char *argv[])
Info<< "pass - null pointer is no expression" << endl;
}
}
catch (Foam::error& err)
catch (const Foam::error& err)
{
Info<< "Caught FatalError " << err << nl << endl;
}
@ -181,7 +181,7 @@ int main(int argc, char *argv[])
Info<< "no match" << endl;
}
}
catch (Foam::error& err)
catch (const Foam::error& err)
{
Info<< "Caught FatalError " << err << nl << endl;
}
@ -198,7 +198,7 @@ int main(int argc, char *argv[])
Info<< "no match" << endl;
}
}
catch (Foam::error& err)
catch (const Foam::error& err)
{
Info<< "Caught FatalError " << err << nl << endl;
}
@ -215,7 +215,7 @@ int main(int argc, char *argv[])
Info<< "no match" << endl;
}
}
catch (Foam::error& err)
catch (const Foam::error& err)
{
Info<< "Caught FatalError " << err << nl << endl;
}
@ -232,7 +232,7 @@ int main(int argc, char *argv[])
Info<< "pass - no match on empty expression" << endl;
}
}
catch (Foam::error& err)
catch (const Foam::error& err)
{
Info<< "Caught FatalError " << err << nl << endl;
}
@ -249,7 +249,7 @@ int main(int argc, char *argv[])
Info<< "pass - no match on empty expression" << endl;
}
}
catch (Foam::error& err)
catch (const Foam::error& err)
{
Info<< "Caught FatalError " << err << nl << endl;
}