1
0
mirror of https://git.dev.opencascade.org/repos/occt.git synced 2025-04-04 18:06:22 +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

@ -37,15 +37,15 @@ is
---C++: inline
---C++: return &
---Level: Advanced
Abort(myclass) 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".
-- Warning: If no catch is prepared for this exception, it displays the
-- exception name and calls "exit(1)".
---Level: Internal
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".
-- Warning: If no catch is prepared for this exception, it displays the
-- exception name and calls "exit(1)".
---Level: Internal
Error(me) returns Failure;
---Purpose: Returns the current Error.

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,21 +139,18 @@ 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);
}
anActive->myStatus = Standard_HandlerJumped;
longjmp(anActive->myLabel, Standard_True);
}
@ -196,15 +194,14 @@ 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();
anActive->myCaughtError = aError;
}
Standard_ErrorHandler* anActive = FindHandler (Standard_HandlerVoid, Standard_False);
if (anActive == NULL)
Abort (theError);
anActive->myCaughtError = theError;
}
Standard_ErrorHandler* Standard_ErrorHandler::FindHandler(const Standard_HandlerStatus theStatus,

View File

@ -138,8 +138,8 @@ void Standard_Failure::Reraise (const Standard_SStream& AReason)
void Standard_Failure::Reraise ()
{
#ifdef NO_CXX_EXCEPTION
Standard_ErrorHandler::Error(this) ;
Standard_ErrorHandler::Abort();
Standard_ErrorHandler::Error (this);
Standard_ErrorHandler::Abort (this);
#else
RaisedError = this;
Throw();
@ -149,8 +149,8 @@ void Standard_Failure::Reraise ()
void Standard_Failure::Jump() const
{
#if defined (NO_CXX_EXCEPTION) || defined (OCC_CONVERT_SIGNALS)
Standard_ErrorHandler::Error(this) ;
Standard_ErrorHandler::Abort();
Standard_ErrorHandler::Error (this);
Standard_ErrorHandler::Abort (this);
#else
RaisedError = this;
Throw();