Improved IOerror in the same manner as error

This commit is contained in:
henry
2009-09-17 16:56:27 +01:00
parent 1d1fd3a37c
commit 47d3f1c31d
2 changed files with 19 additions and 8 deletions

View File

@ -139,10 +139,7 @@ void Foam::IOerror::exit(const int)
if (abort_)
{
Perr<< endl << *this << endl
<< "\nFOAM aborting (FOAM_ABORT set)\n" << endl;
printStack(Perr);
::abort();
abort();
}
if (Pstream::parRun())
@ -155,7 +152,13 @@ void Foam::IOerror::exit(const int)
{
if (throwExceptions_)
{
throw *this;
// Make a copy of the error to throw
IOerror errorException(*this);
// Rewind the message buffer for the next error message
messageStreamPtr_->rewind();
throw errorException;
}
else
{
@ -194,7 +197,13 @@ void Foam::IOerror::abort()
{
if (throwExceptions_)
{
throw *this;
// Make a copy of the error to throw
IOerror errorException(*this);
// Rewind the message buffer for the next error message
messageStreamPtr_->rewind();
throw errorException;
}
else
{
@ -209,7 +218,9 @@ void Foam::IOerror::abort()
Foam::Ostream& Foam::operator<<(Ostream& os, const IOerror& ioErr)
{
os << endl << ioErr.message().c_str() << endl << endl;
os << endl
<< ioErr.title().c_str() << endl
<< ioErr.message().c_str() << endl << endl;
os << "file: " << ioErr.ioFileName().c_str();