From: prascle Date: Fri, 31 Mar 2006 11:07:19 +0000 (+0000) Subject: PR: exception handling X-Git-Tag: T3_2_0b1_pre1~24 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=044abbbfea9ee111836109eacacdccbf54ee455e;p=modules%2Fkernel.git PR: exception handling --- diff --git a/src/LifeCycleCORBA_SWIG/Makefile.am b/src/LifeCycleCORBA_SWIG/Makefile.am index e81652376..996f32c5e 100644 --- a/src/LifeCycleCORBA_SWIG/Makefile.am +++ b/src/LifeCycleCORBA_SWIG/Makefile.am @@ -60,7 +60,9 @@ pkgpyexec_LTLIBRARIES = _libSALOME_LifeCycleCORBA.la _libSALOME_LifeCycleCORBA_la_SOURCES = $(BUILT_SOURCES) $(SWIG_SOURCES) _libSALOME_LifeCycleCORBA_la_CPPFLAGS =\ @PYTHON_INCLUDES@ \ - -I$(srcdir) -I$(srcdir)/../LifeCycleCORBA \ + -I$(srcdir) \ + -I$(srcdir)/../NamingService \ + -I$(srcdir)/../LifeCycleCORBA \ -I$(srcdir)/../Basics \ -I$(srcdir)/../SALOMELocalTrace \ -I$(srcdir)/../Utils \ diff --git a/src/LifeCycleCORBA_SWIG/libSALOME_LifeCycleCORBA.i b/src/LifeCycleCORBA_SWIG/libSALOME_LifeCycleCORBA.i index f6391d930..c9f3f0d3c 100644 --- a/src/LifeCycleCORBA_SWIG/libSALOME_LifeCycleCORBA.i +++ b/src/LifeCycleCORBA_SWIG/libSALOME_LifeCycleCORBA.i @@ -24,7 +24,8 @@ %{ #include "utilities.h" #include "SALOME_LifeCycleCORBA.hxx" - +#include "SALOME_NamingService.hxx" +#include "ServiceUnreachable.hxx" using namespace std; @@ -70,6 +71,21 @@ struct omniORBpyAPI { %} +%exception { + try { + $action + } + catch (ServiceUnreachable) { + PyErr_SetString(PyExc_RuntimeError,"Naming Service Unreacheable"); + return NULL; + } + catch (...) { + PyErr_SetString(PyExc_RuntimeError, "unknown exception"); + return NULL; + } +} + + %typemap(python,out) Engines::Container_ptr, Engines::Component_ptr { MESSAGE("typemap out on CORBA object ptr"); @@ -90,7 +106,6 @@ struct omniORBpyAPI { { //printf("typemap in on Engines::MachineParameters\n"); MESSAGE("typemap in on Engines::MachineParameters"); - //ASSERT (PyDict_Check($input)) if (PyDict_Check($input) == 1) { Engines::MachineParameters *param = new Engines::MachineParameters ; @@ -145,9 +160,8 @@ struct omniORBpyAPI { } else { - //printf("pas un dico\n"); MESSAGE("Not a dictionnary"); - PyErr_SetString(PyExc_TypeError,"MustBe a Python Dictionnary"); + PyErr_SetString(PyExc_TypeError,"Must Be a Python Dictionnary"); return NULL; } }