1 #include "SalomeApp_ExceptionHandler.h"
5 #include <Standard_Failure.hxx>
6 #include <Standard_ErrorHandler.hxx>
13 /*!Constructor. Initialize by \a floatSignal.*/
14 SalomeApp_ExceptionHandler::SalomeApp_ExceptionHandler( const bool floatSignal )
15 : SUIT_ExceptionHandler()
17 OSD::SetSignal( floatSignal );
20 /*!Try to call SUIT_ExceptionHandler::internalHandle(o, e), catch if failure.*/
21 bool SalomeApp_ExceptionHandler::handleSignals( QObject* o, QEvent* e )
24 SUIT_ExceptionHandler::internalHandle( o, e );
26 catch( Standard_Failure )
28 Handle(Standard_Failure) aFail = Standard_Failure::Caught();
29 throw std::runtime_error( aFail->GetMessageString() );
42 /*!Try to call handleSignals( o, e ), catch and show error message.*/
43 bool SalomeApp_ExceptionHandler::handle( QObject* o, QEvent* e )
46 QString title( "Fatal error" );
49 res = handleSignals( o, e );
51 catch( std::exception& ex )
53 showMessage( title, QString( ex.what() ) );
55 catch( Standard_Failure& e )
57 showMessage( title, QString( e.GetMessageString() ) );
62 showMessage( title, "Unknown Exception" );
69 /*!Create new SUIT_ExceptionHandler*/
70 extern "C" SALOMEAPP_EXPORT SUIT_ExceptionHandler* getExceptionHandler()
72 return new SalomeApp_ExceptionHandler( true );