From: vsr Date: Thu, 22 Nov 2018 13:52:05 +0000 (+0300) Subject: To debug exceptions X-Git-Tag: V9_3_0a1~8 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=5cbe4dcea4cd6e202f6eccd4a90dad975ca86756;p=modules%2Fgui.git To debug exceptions --- diff --git a/src/Session/SALOME_Session_Server.cxx b/src/Session/SALOME_Session_Server.cxx index 380ac23e8..7e1c32f05 100755 --- a/src/Session/SALOME_Session_Server.cxx +++ b/src/Session/SALOME_Session_Server.cxx @@ -269,25 +269,30 @@ public: virtual bool notify( QObject* receiver, QEvent* e ) { - - try { - return myHandler ? myHandler->handle( receiver, e ) : QApplication::notify( receiver, e ); - } - catch (std::exception& e) { - std::cerr << e.what() << std::endl; + QString debug_exceptions = ::getenv("SALOME_DEBUG_EXCEPTIONS"); + if ( debug_exceptions.length() > 0 ) { + return QApplication::notify( receiver, e ); } - catch (CORBA::Exception& e) { - std::cerr << "Caught CORBA::Exception" << std::endl; - CORBA::Any tmp; - tmp<<= e; - CORBA::TypeCode_var tc = tmp.type(); - const char *p = tc->name(); - std::cerr << "notify(): CORBA exception of the kind : " << p << " is caught" << std::endl; - } - catch (...) { - std::cerr << "Unknown exception caught in Qt handler: it's probably a bug in SALOME platform" << std::endl; + else { + try { + return myHandler ? myHandler->handle( receiver, e ) : QApplication::notify( receiver, e ); + } + catch (std::exception& e) { + std::cerr << e.what() << std::endl; + } + catch (CORBA::Exception& e) { + std::cerr << "Caught CORBA::Exception" << std::endl; + CORBA::Any tmp; + tmp<<= e; + CORBA::TypeCode_var tc = tmp.type(); + const char *p = tc->name(); + std::cerr << "notify(): CORBA exception of the kind : " << p << " is caught" << std::endl; + } + catch (...) { + std::cerr << "Unknown exception caught in Qt handler: it's probably a bug in SALOME platform" << std::endl; + } + return false; // return false when exception is caught } - return false; // return false when exception is caught } SUIT_ExceptionHandler* handler() const { return myHandler; } void setHandler( SUIT_ExceptionHandler* h ) { myHandler = h; }