1 #include "CASCatch_Failure.hxx"
2 #include "CASCatch_ErrorHandler.hxx"
3 #include <Standard_TypeMismatch.hxx>
4 #include <Standard_Type.hxx>
7 IMPLEMENT_STANDARD_HANDLE( CASCatch_Failure, Standard_Transient )
8 IMPLEMENT_STANDARD_RTTIEXT( CASCatch_Failure, Standard_Transient )
11 #ifndef NO_CXX_EXCEPTION
12 static Handle(CASCatch_Failure) RaisedError;
15 //================================================================================
17 * \brief creates a CASCatch_Failure
19 //================================================================================
20 CASCatch_Failure::CASCatch_Failure () { myMessage = "Signal detected";}
23 //================================================================================
25 * \brief creates a CASCatch_Failure with a message
26 * \param an exception message
28 //================================================================================
29 CASCatch_Failure::CASCatch_Failure (const Standard_CString AString)
32 myMessage = new Standard_Character[strlen(AString) + 1];
33 strcpy(myMessage,AString);
37 //================================================================================
39 * \brief returns the last caught exception
41 //================================================================================
42 Handle(CASCatch_Failure) CASCatch_Failure::Caught()
44 #ifdef NO_CXX_EXCEPTION
45 return CASCatch_ErrorHandler::LastCaughtError();
51 //================================================================================
53 * \brief raises a CASCatch_Failure exception
54 * \param an exception message
56 //================================================================================
57 void CASCatch_Failure::Raise (const Standard_CString AString)
59 Handle(CASCatch_Failure) E = new CASCatch_Failure() ;
60 E->Reraise (AString) ;
64 //================================================================================
66 * \brief re-raises a CASCatch_Failure exception
67 * \param an exception message
69 //================================================================================
70 void CASCatch_Failure::Reraise (const Standard_CString AString)
73 myMessage = new Standard_Character[strlen(AString) + 1];
74 strcpy(myMessage,AString);
77 #ifdef NO_CXX_EXCEPTION
78 CASCatch_ErrorHandler::Error(this) ;
79 CASCatch_ErrorHandler::Abort();
86 //================================================================================
88 * \brief returns an exception message
90 //================================================================================
91 Standard_CString CASCatch_Failure::GetError() const
96 //================================================================================
98 * \brief Is called when using standard C++ exceptions
100 //================================================================================
101 void CASCatch_Failure::Throw() const
103 #ifndef NO_CXX_EXCEPTION
104 throw CASCatch_Failure() ;