From 5cbe4dcea4cd6e202f6eccd4a90dad975ca86756 Mon Sep 17 00:00:00 2001 From: vsr Date: Thu, 22 Nov 2018 16:52:05 +0300 Subject: [PATCH] To debug exceptions --- src/Session/SALOME_Session_Server.cxx | 39 +++++++++++++++------------ 1 file changed, 22 insertions(+), 17 deletions(-) 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; } -- 2.39.2