1 // Copyright (C) 2005 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
2 // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
4 // This library is free software; you can redistribute it and/or
5 // modify it under the terms of the GNU Lesser General Public
6 // License as published by the Free Software Foundation; either
7 // version 2.1 of the License.
9 // This library is distributed in the hope that it will be useful
10 // but WITHOUT ANY WARRANTY; without even the implied warranty of
11 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 // Lesser General Public License for more details.
14 // You should have received a copy of the GNU Lesser General Public
15 // License along with this library; if not, write to the Free Software
16 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
18 // See http://www.salome-platform.org/
20 #include "CASCatch_Failure.hxx"
21 #include "CASCatch_ErrorHandler.hxx"
22 #include <Standard_TypeMismatch.hxx>
23 #include <Standard_Type.hxx>
26 IMPLEMENT_STANDARD_HANDLE( CASCatch_Failure, Standard_Transient )
27 IMPLEMENT_STANDARD_RTTIEXT( CASCatch_Failure, Standard_Transient )
30 #ifndef NO_CXX_EXCEPTION
31 static Handle(CASCatch_Failure) RaisedError;
34 //================================================================================
36 * \brief creates a CASCatch_Failure
38 //================================================================================
39 CASCatch_Failure::CASCatch_Failure () { myMessage = "Signal detected";}
42 //================================================================================
44 * \brief creates a CASCatch_Failure with a message
45 * \param an exception message
47 //================================================================================
48 CASCatch_Failure::CASCatch_Failure (const Standard_CString AString)
51 myMessage = new Standard_Character[strlen(AString) + 1];
52 strcpy(myMessage,AString);
56 //================================================================================
58 * \brief returns the last caught exception
60 //================================================================================
61 Handle(CASCatch_Failure) CASCatch_Failure::Caught()
63 #ifdef NO_CXX_EXCEPTION
64 return CASCatch_ErrorHandler::LastCaughtError();
70 //================================================================================
72 * \brief raises a CASCatch_Failure exception
73 * \param an exception message
75 //================================================================================
76 void CASCatch_Failure::Raise (const Standard_CString AString)
78 Handle(CASCatch_Failure) E = new CASCatch_Failure() ;
79 E->Reraise (AString) ;
83 //================================================================================
85 * \brief re-raises a CASCatch_Failure exception
86 * \param an exception message
88 //================================================================================
89 void CASCatch_Failure::Reraise (const Standard_CString AString)
92 myMessage = new Standard_Character[strlen(AString) + 1];
93 strcpy(myMessage,AString);
96 #ifdef NO_CXX_EXCEPTION
97 CASCatch_ErrorHandler::Error(this) ;
98 CASCatch_ErrorHandler::Abort();
105 //================================================================================
107 * \brief returns an exception message
109 //================================================================================
110 Standard_CString CASCatch_Failure::GetError() const
115 //================================================================================
117 * \brief Is called when using standard C++ exceptions
119 //================================================================================
120 void CASCatch_Failure::Throw() const
122 #ifndef NO_CXX_EXCEPTION
123 throw CASCatch_Failure() ;