diff --git a/src/OpenFOAM/db/error/error.C b/src/OpenFOAM/db/error/error.C index 7dc6b2e4e21d37190c964e670b43158552331015..ed3502f9b6f23a93ca47b9b235618d74ab8871c9 100644 --- a/src/OpenFOAM/db/error/error.C +++ b/src/OpenFOAM/db/error/error.C @@ -105,7 +105,6 @@ Foam::OSstream& Foam::error::operator() const int sourceFileLineNumber ) { - messageStreamPtr_->rewind(); functionName_ = functionName; sourceFileName_ = sourceFileName; sourceFileLineNumber_ = sourceFileLineNumber; @@ -137,7 +136,6 @@ Foam::error::operator OSstream&() Perr<< endl << "error::operator OSstream&() : error stream has failed" << endl; - printStack(Perr); abort(); } @@ -178,9 +176,6 @@ void Foam::error::exit(const int errNo) if (abort_) { - printStack(*this); - Perr<< endl << *this << endl - << "\nFOAM aborting (FOAM_ABORT set)\n" << endl; abort(); } @@ -194,7 +189,13 @@ void Foam::error::exit(const int errNo) { if (throwExceptions_) { - throw *this; + // Make a copy of the error to throw + error errorException(*this); + + // Rewind the message buffer for the next error message + messageStreamPtr_->rewind(); + + throw errorException; } else { @@ -216,30 +217,36 @@ void Foam::error::abort() if (abort_) { - printStack(*this); Perr<< endl << *this << endl << "\nFOAM aborting (FOAM_ABORT set)\n" << endl; + printStack(Perr); ::abort(); } if (Pstream::parRun()) { - printStack(*this); Perr<< endl << *this << endl << "\nFOAM parallel run aborting\n" << endl; + printStack(Perr); Pstream::abort(); } else { if (throwExceptions_) { + // Make a copy of the error to throw + error errorException(*this); + + // Rewind the message buffer for the next error message + messageStreamPtr_->rewind(); + throw *this; } else { - printStack(*this); Perr<< endl << *this << endl << "\nFOAM aborting\n" << endl; + printStack(Perr); ::abort(); } } @@ -248,7 +255,9 @@ void Foam::error::abort() Foam::Ostream& Foam::operator<<(Ostream& os, const error& fErr) { - os << endl << fErr.message().c_str(); + os << endl + << fErr.title().c_str() << endl + << fErr.message().c_str(); if (error::level >= 2 && fErr.sourceFileLineNumber()) { diff --git a/src/OpenFOAM/db/error/messageStream.C b/src/OpenFOAM/db/error/messageStream.C index 67efeb69fa9ffaa54856e6d75945d26cf4c451a3..2d3991731f2d00a8da438a567ee78ccb017afaec 100644 --- a/src/OpenFOAM/db/error/messageStream.C +++ b/src/OpenFOAM/db/error/messageStream.C @@ -35,7 +35,6 @@ int Foam::messageStream::level(Foam::debug::debugSwitch("level", 2)); // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // -// Construct from components Foam::messageStream::messageStream ( const string& title, @@ -50,7 +49,6 @@ Foam::messageStream::messageStream {} -//- Construct from dictionary Foam::messageStream::messageStream(const dictionary& dict) : title_(dict.lookup("title")), diff --git a/tutorials/incompressible/simpleFoam/motorBike/constant/polyMesh/boundary b/tutorials/incompressible/simpleFoam/motorBike/constant/polyMesh/boundary index e96b062da6c50f46982c4d4342123a1b0105deee..b79c6ad432aaa5f1f3da3b5a4b9561d698e8cdb5 100644 --- a/tutorials/incompressible/simpleFoam/motorBike/constant/polyMesh/boundary +++ b/tutorials/incompressible/simpleFoam/motorBike/constant/polyMesh/boundary @@ -1,7 +1,7 @@ /*--------------------------------*- C++ -*----------------------------------*\ | ========= | | | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | -| \\ / O peration | Version: 1.6 | +| \\ / O peration | Version: dev | | \\ / A nd | Web: www.OpenFOAM.org | | \\/ M anipulation | | \*---------------------------------------------------------------------------*/