Salome HOME
Replaced the old execption handler by the new one.
[modules/gui.git] / src / Session / Session_SignalsHandler.cxx
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;
 }