1
0
mirror of https://git.dev.opencascade.org/repos/occt.git synced 2025-04-10 18:51:21 +03:00

0022730: Print available info about exception missed in some cases

This commit is contained in:
kgv 2012-03-06 11:55:39 +04:00 committed by bugmaster
parent 9991c9c2ca
commit a01039b9fd
3 changed files with 28 additions and 31 deletions

View File

@ -38,7 +38,7 @@ is
---C++: return &
---Level: Advanced
Abort(myclass) is private;
Abort(myclass; theError : Failure) is private;
---Purpose: A exception is raised but it is not yet caught.
-- So Abort the current function and transmit the exception
-- to "calling routines".

View File

@ -66,9 +66,10 @@ Standard_ErrorHandler::Standard_ErrorHandler () :
void Standard_ErrorHandler::Destroy()
{
Unlink();
if(myStatus==Standard_HandlerJumped) {
//jumped, but not caut
Abort();
if (myStatus == Standard_HandlerJumped)
{
// jumped, but not caught
Abort (myCaughtError);
}
}
@ -138,18 +139,15 @@ Standard_Boolean Standard_ErrorHandler::IsInTryBlock()
//==== Abort if there is a non null 'Error'
//============================================================================
void Standard_ErrorHandler::Abort ()
void Standard_ErrorHandler::Abort (const Handle(Standard_Failure)& theError)
{
Standard_ErrorHandler* anActive = FindHandler(Standard_HandlerVoid, Standard_True);
//==== Check if can do the "longjmp" =======================================
if(anActive == NULL || anActive->myLabel == NULL) {
cerr << "*** Abort *** an exception was raised, but no catch was found." << endl;
Handle(Standard_Failure) anErr =
( anActive != NULL && ! anActive->myCaughtError.IsNull() ?
anActive->myCaughtError : Standard_Failure::Caught() );
if ( ! anErr.IsNull() )
cerr << "\t... The exception is:" << anErr->GetMessageString() << endl;
if (!theError.IsNull())
cerr << "\t... The exception is:" << theError->GetMessageString() << endl;
exit(1);
}
@ -196,17 +194,16 @@ Handle(Standard_Failure) Standard_ErrorHandler::Error() const
}
void Standard_ErrorHandler::Error(const Handle(Standard_Failure)& aError)
void Standard_ErrorHandler::Error (const Handle(Standard_Failure)& theError)
{
Standard_ErrorHandler* anActive = FindHandler (Standard_HandlerVoid, Standard_False);
if(anActive==0)
Abort();
if (anActive == NULL)
Abort (theError);
anActive->myCaughtError = aError;
anActive->myCaughtError = theError;
}
Standard_ErrorHandler* Standard_ErrorHandler::FindHandler(const Standard_HandlerStatus theStatus,
const Standard_Boolean theUnlink)
{

View File

@ -139,7 +139,7 @@ void Standard_Failure::Reraise ()
{
#ifdef NO_CXX_EXCEPTION
Standard_ErrorHandler::Error (this);
Standard_ErrorHandler::Abort();
Standard_ErrorHandler::Abort (this);
#else
RaisedError = this;
Throw();
@ -150,7 +150,7 @@ void Standard_Failure::Jump() const
{
#if defined (NO_CXX_EXCEPTION) || defined (OCC_CONVERT_SIGNALS)
Standard_ErrorHandler::Error (this);
Standard_ErrorHandler::Abort();
Standard_ErrorHandler::Abort (this);
#else
RaisedError = this;
Throw();