From: abn Date: Mon, 22 Sep 2014 14:36:40 +0000 (+0200) Subject: Added raiseAnException() in the IDL and the engine to test exception mechanism. X-Git-Tag: V7_5_0a1^0 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=bb0c8f4a75ffe46a75307f5a264ae5591110f15c;p=samples%2Fpyhello.git Added raiseAnException() in the IDL and the engine to test exception mechanism. --- diff --git a/idl/PYHELLO_Gen.idl b/idl/PYHELLO_Gen.idl index 1824d9c..cfdc2e7 100644 --- a/idl/PYHELLO_Gen.idl +++ b/idl/PYHELLO_Gen.idl @@ -40,7 +40,10 @@ module PYHELLO_ORB raises (SALOME::SALOME_Exception); void createObject(in SALOMEDS::Study theStudy, - in string name) + in string name) + raises (SALOME::SALOME_Exception); + + void raiseAnException() raises (SALOME::SALOME_Exception); }; }; diff --git a/src/PYHELLO/PYHELLO.py b/src/PYHELLO/PYHELLO.py index b9592b9..950463b 100644 --- a/src/PYHELLO/PYHELLO.py +++ b/src/PYHELLO/PYHELLO.py @@ -67,6 +67,14 @@ class PYHELLO(PYHELLO_ORB__POA.PYHELLO_Gen, banner = "Hello %s!" % name return banner + """ + Intentionnally raises an exception for test purposes. + """ + def raiseAnException( self ): + import SALOME + exData = SALOME.ExceptionStruct( SALOME.BAD_PARAM, "Test exception in raiseAnException()",'',0) + raise SALOME.SALOME_Exception( exData ) + """ Create object. """