[omniORB] Python exceptions and omniORBpy
Cetateanu Marius-B01107
Marius.Cetateanu at freescale.com
Fri Sep 11 16:16:34 BST 2009
Here's the IDL:
module ExceptionM {
exception DataException {
string msg;
};
exception DataObjException {
string msg;
};
};
And a java code snippet:
...
try {
DataObjDef dataObj = dataFile.getDataObjectByGUID(doGUID);
if (dataObj !=
null) {
// do
the dew
} else {
// do
the undew
}
} catch (DataException de) {
// logger call
}
...
Marius Cetateanu
DevTech - Software Engineer
Freescale Semiconductor Romania SRL
45, Tudor Vladimirescu Street
Tati Business Center
Bucharest 050881, Romania
www.freescale.com
Phone: +040 213052078
Mobile: +040 742191809
Fax: +040 213052000
email: Marius.Cetateanu at freescale.com
-----Original Message-----
From: Michael [mailto:omniorb at bindone.de]
Sent: Friday, September 11, 2009 5:11 PM
To: Cetateanu Marius-B01107
Cc: omniorb-list at omniorb-support.com
Subject: Re: [omniORB] Python exceptions and omniORBpy
And the IDL?
Cetateanu Marius-B01107 wrote:
> No, I'm throwing the correct exception. Below is a code snippet:
>
> def getDataObjectByGUID(self, guid):
> """Return a reference to a data object given its unique
> global identifier(GUID)."""
>
> try:
> self._acquire()
> dataObjList = self.getDataObjs()
> # Loop over all the elements in a list,
> for dobj in dataObjList:
> if dobj.getGUID() == guid:
> return dobj
>
> # If we get here we didn't find it.
> msg = '^^%s: data object with GUID=%s not found.'
> raise ExceptionM.DataException(msg[2:] %(self.getName(),
> guid))
> finally:
> self._release()
>
>
> Marius Cetateanu
> DevTech - Software Engineer
> Freescale Semiconductor Romania SRL
> 45, Tudor Vladimirescu Street
> Tati Business Center
> Bucharest 050881, Romania
> www.freescale.com
> Phone: +040 213052078
> Mobile: +040 742191809
> Fax: +040 213052000
> email: Marius.Cetateanu at freescale.com
>
>
> -----Original Message-----
> From: Michael [mailto:omniorb at bindone.de]
> Sent: Friday, September 11, 2009 4:42 PM
> To: Cetateanu Marius-B01107
> Cc: omniorb-list at omniorb-support.com
> Subject: Re: [omniORB] Python exceptions and omniORBpy
>
> Can you post the IDL and a python code snippet?
> It sounds like you're throwing a CORBA.UserException directly, but
> afaik a concrete exception type defined in the IDL (exception { and
> raises on the method) has to be thrown.
>
>
> Cetateanu Marius-B01107 wrote:
>> Hi,
>>
>> I'm having some trouble using exceptions with omniORBpy. I have a
>> server side written in Python and a client that's written in Java. I
>> described my exceptions properly in the IDL and I have generated both
>> the Java and Python stubs. I have some class methods in python that
>> are raising exceptions (CORBA.UserException) but I cannot seem to
>> catch them in Java (I'm using try ... catch properly on Java side and
>> my stubs were properly generated).
>> What I get from omniORB is just:
>>
>> omniORB: Caught an unexpected Python exception during up-call.
>> Traceback (most recent call last):
>> File
>> "D:\work\build_workon_stable\analysis\1.1.0\lib\host\engine\intf\Data
>> F il e.py", line 449, in getDataObjectByGUID
>> raise ExceptionM.DataException(msg[2:] %(self.getName(), guid))
>> intf.stubsCORBA.ExceptionM.DataException:
>> intf.stubsCORBA.ExceptionM.DataException(msg='analysis_simulator_setu
>> p
>> _0
>> 000.datafile: data object with
>> GUID=e9216c8c-81df-4a78-a25f-bfd855b62881
>> not found.')
>>
>> and an org.omg.CORBA.UNKNOWN gets to the Java side with minor code 98
>> (BTW does anyone know what that minor code means?
>> I couldn't find any reference on it). I searched the omniorb list and
>> I found a message from February 2009
>> http://www.omniorb-support.com/pipermail/omniorb-list/2009-February/0
>> 2
>> 99
>> 44.html
>>
>> I qoute: "The problem is that Fedora 10 has Python 2.5. In Python
>> 2.5,
>
>> exceptions were changed to be new-style classes. Older versions of
>> omniORBpy assumed they were old-style classes.
>>
>> You'll have to update to omniORB 4.1.3 and omniORBpy 3.3 to be able
>> to
>
>> work with Python 2.5."
>>
>> I'm using omniORB 4.0.7, omniORBpy 2.7 and Python 2.5 on Windows XP,
>> so does the above apply to my situation also (I kind of think it does
>> but I need a confirmation)?
>>
>> Thank you!
>>
>> Marius Cetateanu
>> DevTech - Software Engineer
>> Freescale Semiconductor Romania SRL
>> 45, Tudor Vladimirescu Street
>> Tati Business Center
>> Bucharest 050881, Romania
>> www.freescale.com
>> Phone: +040 213052078
>> Mobile: +040 742191809
>> Fax: +040 213052000
>> email: Marius.Cetateanu at freescale.com
>>
>>
>> _______________________________________________
>> omniORB-list mailing list
>> omniORB-list at omniorb-support.com
>> http://www.omniorb-support.com/mailman/listinfo/omniorb-list
>
More information about the omniORB-list
mailing list