From 7e5876a3a39c4328d834794c5ed6db98d4b15a77 Mon Sep 17 00:00:00 2001 From: prascle Date: Mon, 4 Sep 2006 05:46:08 +0000 Subject: [PATCH] PR: EDF 260: transfer of the exception message to python --- .../Test/LifeCycleCORBA_SWIGTest.py | 2 +- .../libSALOME_LifeCycleCORBA.i | 22 +++++++++---------- 2 files changed, 12 insertions(+), 12 deletions(-) diff --git a/src/LifeCycleCORBA_SWIG/Test/LifeCycleCORBA_SWIGTest.py b/src/LifeCycleCORBA_SWIG/Test/LifeCycleCORBA_SWIGTest.py index ada3edbb0..e979e3920 100644 --- a/src/LifeCycleCORBA_SWIG/Test/LifeCycleCORBA_SWIGTest.py +++ b/src/LifeCycleCORBA_SWIG/Test/LifeCycleCORBA_SWIGTest.py @@ -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 diff --git a/src/LifeCycleCORBA_SWIG/libSALOME_LifeCycleCORBA.i b/src/LifeCycleCORBA_SWIG/libSALOME_LifeCycleCORBA.i index 29d6de464..b017bb535 100644 --- a/src/LifeCycleCORBA_SWIG/libSALOME_LifeCycleCORBA.i +++ b/src/LifeCycleCORBA_SWIG/libSALOME_LifeCycleCORBA.i @@ -224,31 +224,31 @@ struct omniORBpyAPI { %include %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<