From: Ovidiu MIRCESCU Date: Tue, 13 Sep 2022 09:22:46 +0000 (+0200) Subject: Better exception messages in python nodes. X-Git-Tag: EMC2P-1.3.6-rc5^2 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=29bd2d7005bb53a0d8ce7012a96d3dcd667b5842;p=modules%2Fyacs.git Better exception messages in python nodes. --- diff --git a/src/runtime/PythonNode.cxx b/src/runtime/PythonNode.cxx index b72a37167..9cc71d542 100644 --- a/src/runtime/PythonNode.cxx +++ b/src/runtime/PythonNode.cxx @@ -497,6 +497,60 @@ void PythonNode::executeRemote() _errorDetails=msg.str(); throw Exception(msg.str()); } + catch(CORBA::COMM_FAILURE& ex) + { + std::ostringstream msg; + msg << "Exception on remote python invocation." << std::endl ; + msg << "Caught system exception COMM_FAILURE -- unable to contact the " + << "object." << std::endl; + _errorDetails=msg.str(); + throw Exception(msg.str()); + } + catch(CORBA::SystemException& ex) + { + std::ostringstream msg; + msg << "Exception on remote python invocation." << std::endl ; + msg << "Caught a CORBA::SystemException." ; + CORBA::Any tmp; + tmp <<= ex; + CORBA::TypeCode_var tc = tmp.type(); + const char *p = tc->name(); + if ( *p != '\0' ) + msg <id(); + msg << std::endl; + _errorDetails=msg.str(); + throw Exception(msg.str()); + } + catch(CORBA::Exception& ex) + { + std::ostringstream msg; + msg << "Exception on remote python invocation." << std::endl ; + msg << "Caught CORBA::Exception. " ; + CORBA::Any tmp; + tmp <<= ex; + CORBA::TypeCode_var tc = tmp.type(); + const char *p = tc->name(); + if ( *p != '\0' ) + msg <id(); + msg << std::endl; + _errorDetails=msg.str(); + throw Exception(msg.str()); + } + catch(omniORB::fatalException& fe) + { + std::ostringstream msg; + msg << "Exception on remote python invocation." << std::endl ; + msg << "Caught omniORB::fatalException:" << std::endl; + msg << " file: " << fe.file() << std::endl; + msg << " line: " << fe.line() << std::endl; + msg << " mesg: " << fe.errmsg() << std::endl; + _errorDetails=msg.str(); + throw Exception(msg.str()); + } // if(!CORBA::is_nil(_pynode)) // { // _pynode->UnRegister(); @@ -1158,6 +1212,60 @@ void PyFuncNode::executeRemote() _errorDetails=msg; throw Exception(msg); } + catch(CORBA::COMM_FAILURE& ex) + { + std::ostringstream msg; + msg << "Exception on remote python invocation." << std::endl ; + msg << "Caught system exception COMM_FAILURE -- unable to contact the " + << "object." << std::endl; + _errorDetails=msg.str(); + throw Exception(msg.str()); + } + catch(CORBA::SystemException& ex) + { + std::ostringstream msg; + msg << "Exception on remote python invocation." << std::endl ; + msg << "Caught a CORBA::SystemException." ; + CORBA::Any tmp; + tmp <<= ex; + CORBA::TypeCode_var tc = tmp.type(); + const char *p = tc->name(); + if ( *p != '\0' ) + msg <id(); + msg << std::endl; + _errorDetails=msg.str(); + throw Exception(msg.str()); + } + catch(CORBA::Exception& ex) + { + std::ostringstream msg; + msg << "Exception on remote python invocation." << std::endl ; + msg << "Caught CORBA::Exception. " ; + CORBA::Any tmp; + tmp <<= ex; + CORBA::TypeCode_var tc = tmp.type(); + const char *p = tc->name(); + if ( *p != '\0' ) + msg <id(); + msg << std::endl; + _errorDetails=msg.str(); + throw Exception(msg.str()); + } + catch(omniORB::fatalException& fe) + { + std::ostringstream msg; + msg << "Exception on remote python invocation." << std::endl ; + msg << "Caught omniORB::fatalException:" << std::endl; + msg << " file: " << fe.file() << std::endl; + msg << " line: " << fe.line() << std::endl; + msg << " mesg: " << fe.errmsg() << std::endl; + _errorDetails=msg.str(); + throw Exception(msg.str()); + } DEBTRACE( "-----------------end of remote python invocation-----------------" ); //=========================================================================== // Get results, unpickle and put them in output ports