]> SALOME platform Git repositories - modules/gui.git/commitdiff
Salome HOME
Replaced the old execption handler by the new one.
authorsrn <srn@opencascade.com>
Tue, 30 Aug 2005 05:20:29 +0000 (05:20 +0000)
committersrn <srn@opencascade.com>
Tue, 30 Aug 2005 05:20:29 +0000 (05:20 +0000)
src/SalomeApp/SalomeApp_ExceptionHandler.cxx
src/Session/Session_SignalsHandler.cxx

index eff88e81e49396393512a374a28067a4620ade99..68abb4c46d16c4aeebbe7fb1d898f151413e248a 100644 (file)
 
 #include <qstring.h>
 
+#include <CASCatch_CatchSignals.hxx>
+#include <CASCatch_ErrorHandler.hxx>
+#include <CASCatch_Failure.hxx> 
+
+
 /*!Constructor. Initialize by \a floatSignal.*/
 SalomeApp_ExceptionHandler::SalomeApp_ExceptionHandler( const bool floatSignal )
 : SUIT_ExceptionHandler()
@@ -20,14 +25,21 @@ SalomeApp_ExceptionHandler::SalomeApp_ExceptionHandler( const bool floatSignal )
 /*!Try to call SUIT_ExceptionHandler::internalHandle(o, e), catch if failure.*/
 bool SalomeApp_ExceptionHandler::handleSignals( QObject* o, QEvent* e )
 {
-  try {
+
+  CASCatch_CatchSignals aCatchSignals;
+  aCatchSignals.Activate();
+    
+    
+  CASCatch_TRY {   
     SUIT_ExceptionHandler::internalHandle( o, e );
   }
-  catch( Standard_Failure )
-  {
-    Handle(Standard_Failure) aFail = Standard_Failure::Caught();
-    throw std::runtime_error( aFail->GetMessageString() );
+  CASCatch_CATCH(CASCatch_Failure) {
+    aCatchSignals.Deactivate();
+    Handle(CASCatch_Failure) aFail = CASCatch_Failure::Caught();          
+    throw std::runtime_error( aFail->GetError() );
   }
+  
+  aCatchSignals.Deactivate();   
   return true;
 }
 
index c02f6132a9da1260b5fb470be72f220205bd7fd8..4eeface46272685d2716a12d3a4123d0f51c8452 100755 (executable)
 #include <stdexcept>
 #include <qapplication.h>
 
-#include "CASCatch_SignalsHandler.h" // CAREFUL ! position of this file is critic : see Lucien PIGNOLONI / OCC
-
+#include <CASCatch_CatchSignals.hxx>
+#include <CASCatch_ErrorHandler.hxx>
+#include <CASCatch_Failure.hxx>
 
 extern "C" int HandleSignals(QApplication *theQApplication)
 {
-  CASCatch_SignalsHandler aSignalsHandler;
-  int aRet = -1;
-  try {
+  int aRet = -1; 
+  CASCatch_CatchSignals aCatchSignals;
+  aCatchSignals.Activate();
+        
+  CASCatch_TRY {       
     aRet = theQApplication->exec();
-  }catch(Standard_Failure){
-    Handle(Standard_Failure) aFail = Standard_Failure::Caught();
-    throw std::runtime_error(aFail->GetMessageString());
   }
+  CASCatch_CATCH(CASCatch_Failure) {
+    aCatchSignals.Deactivate();    
+    Handle(CASCatch_Failure) aFail = CASCatch_Failure::Caught();
+    throw std::runtime_error( aFail->GetError() );   
+  }
+  
+  aCatchSignals.Deactivate(); 
   return aRet;
 }