]> SALOME platform Git repositories - modules/kernel.git/commitdiff
Salome HOME
PR: EDF 260: transfer of the exception message to python
authorprascle <prascle>
Mon, 4 Sep 2006 05:46:08 +0000 (05:46 +0000)
committerprascle <prascle>
Mon, 4 Sep 2006 05:46:08 +0000 (05:46 +0000)
src/LifeCycleCORBA_SWIG/Test/LifeCycleCORBA_SWIGTest.py
src/LifeCycleCORBA_SWIG/libSALOME_LifeCycleCORBA.i

index ada3edbb0b887fcd1a2954cff0990c965af099af..e979e3920b4fe1e565c53d661ed9a893efd0f4ed 100644 (file)
@@ -179,7 +179,7 @@ class LifeCycleCORBA_SWIGTest(unittest.TestCase):
         try:
             cp1=self.lcc.FindOrLoad_Component(containerName,"SalomeTestComponent")
         except RuntimeError,ex :
-            self.assertEqual(ex.args[0],'SALOME exception')
+            self.assertEqual(ex.args[0],'Salome Exception : unknown host')
         pass
        
     
index 29d6de464a6d4faf451c9fff6493223361d15d15..b017bb535e6d92487143ab50aaf2ec96c3c7c2e8 100644 (file)
@@ -224,31 +224,31 @@ struct omniORBpyAPI {
 %include <Utils_SALOME_Exception.hxx>
 
 %exception {
-    PyThreadState *_save;
-    _save = PyEval_SaveThread();
+    Py_BEGIN_ALLOW_THREADS
     try {
       $action
     }
     catch (ServiceUnreachable) {
-       PyEval_RestoreThread(_save);
+       Py_BLOCK_THREADS
        PyErr_SetString(PyExc_RuntimeError,"Naming Service Unreacheable");
        return NULL;
     }
+    catch (SALOME_Exception &e) {
+       Py_BLOCK_THREADS
+       PyErr_SetString(PyExc_RuntimeError,e.what());
+       return NULL;
+    }
     catch (SALOME::SALOME_Exception &e) {
-       MESSAGE("catch SALOME exception");
-       //std::ostringstream os; os<<e;
-       PyEval_RestoreThread(_save);
-       //PyErr_SetString(PyExc_RuntimeError,os.str().c_str());
-       //PyErr_SetString(PyExc_RuntimeError,e.what());
-       SWIG_exception(SWIG_RuntimeError,"SALOME exception");
+       Py_BLOCK_THREADS
+       PyErr_SetString(PyExc_RuntimeError,e.details.text);
        return NULL;
     }
     catch (...) {
-       PyEval_RestoreThread(_save);
+       Py_BLOCK_THREADS
        PyErr_SetString(PyExc_RuntimeError, "unknown exception");
        return NULL;
     }
-    PyEval_RestoreThread(_save);
+    Py_END_ALLOW_THREADS
 }