ENH: functionObjectList: format errors from FO reading. Fixes #575.
This commit is contained in:
parent
4818b5808e
commit
a79d2835f1
@ -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 * * * * * * * * * * * * //
|
||||
|
||||
Foam::Ostream& Foam::operator<<(Ostream& os, const error& err)
|
||||
{
|
||||
os << nl
|
||||
<< 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() << '.';
|
||||
}
|
||||
err.write(os);
|
||||
|
||||
return os;
|
||||
}
|
||||
|
@ -195,6 +195,9 @@ public:
|
||||
// Prints stack before exiting.
|
||||
void abort();
|
||||
|
||||
//- Print error message
|
||||
void write(Ostream& os, const bool includeTitle = true) const;
|
||||
|
||||
|
||||
// Ostream operator
|
||||
|
||||
|
@ -788,8 +788,9 @@ bool Foam::functionObjectList::read()
|
||||
}
|
||||
catch (Foam::error& err)
|
||||
{
|
||||
WarningInFunction
|
||||
<< "Caught FatalError " << err << nl << endl;
|
||||
// Bit of trickery to get the original message
|
||||
err.write(Warning, false);
|
||||
InfoInFunction << nl << endl;
|
||||
}
|
||||
|
||||
// Restore previous exception throwing state
|
||||
|
Loading…
Reference in New Issue
Block a user