mirror of
https://develop.openfoam.com/Development/openfoam.git
synced 2025-11-28 03:28:01 +00:00
ENH: functionObjectList: format errors from FO reading. Fixes #575.
This commit is contained in:
@ -250,21 +250,30 @@ void Foam::error::abort()
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void Foam::error::write(Ostream& os, const bool includeTitle) const
|
||||||
|
{
|
||||||
|
os << nl;
|
||||||
|
if (includeTitle)
|
||||||
|
{
|
||||||
|
os << title().c_str() << endl;
|
||||||
|
}
|
||||||
|
os << message().c_str();
|
||||||
|
|
||||||
|
if (error::level >= 2 && sourceFileLineNumber())
|
||||||
|
{
|
||||||
|
os << nl << nl
|
||||||
|
<< " From function " << functionName().c_str() << endl
|
||||||
|
<< " in file " << sourceFileName().c_str()
|
||||||
|
<< " at line " << sourceFileLineNumber() << '.';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * IOstream Operators * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * IOstream Operators * * * * * * * * * * * * //
|
||||||
|
|
||||||
Foam::Ostream& Foam::operator<<(Ostream& os, const error& err)
|
Foam::Ostream& Foam::operator<<(Ostream& os, const error& err)
|
||||||
{
|
{
|
||||||
os << nl
|
err.write(os);
|
||||||
<< err.title().c_str() << endl
|
|
||||||
<< err.message().c_str();
|
|
||||||
|
|
||||||
if (error::level >= 2 && err.sourceFileLineNumber())
|
|
||||||
{
|
|
||||||
os << nl << nl
|
|
||||||
<< " From function " << err.functionName().c_str() << endl
|
|
||||||
<< " in file " << err.sourceFileName().c_str()
|
|
||||||
<< " at line " << err.sourceFileLineNumber() << '.';
|
|
||||||
}
|
|
||||||
|
|
||||||
return os;
|
return os;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -195,6 +195,9 @@ public:
|
|||||||
// Prints stack before exiting.
|
// Prints stack before exiting.
|
||||||
void abort();
|
void abort();
|
||||||
|
|
||||||
|
//- Print error message
|
||||||
|
void write(Ostream& os, const bool includeTitle = true) const;
|
||||||
|
|
||||||
|
|
||||||
// Ostream operator
|
// Ostream operator
|
||||||
|
|
||||||
|
|||||||
@ -788,8 +788,9 @@ bool Foam::functionObjectList::read()
|
|||||||
}
|
}
|
||||||
catch (Foam::error& err)
|
catch (Foam::error& err)
|
||||||
{
|
{
|
||||||
WarningInFunction
|
// Bit of trickery to get the original message
|
||||||
<< "Caught FatalError " << err << nl << endl;
|
err.write(Warning, false);
|
||||||
|
InfoInFunction << nl << endl;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Restore previous exception throwing state
|
// Restore previous exception throwing state
|
||||||
|
|||||||
Reference in New Issue
Block a user