[omniORB] omniORBpy raising exception issue

Bernard Niset bn@7ways.com
Mon, 10 Apr 2000 11:30:49 +0200


Hello all,

I am trying to raise an exception in an implementation written in python. I
am using the regular raise python keyword to do it on the server and the
regular try/catch mechanism in the client, but I don't get the expected
results on the client : apparently an omniORB.CORBA.UNKNOWN exception is
received on the client while I am expecting a cdv.NotFound exception.

I don't think this question is related to the other omniORBpy exception
thread that occured in this mailing list before. Any help to sort it out
would be greatly appreciated.

Thanks in advance,

Bernard Niset
TLDnames development team www.tldnames.com.


excerpt of the IDL:

module cdv
{
 exception NotFound
 {
  string key;
 };

.....

Code of client call:

try:
     info = object_ref.getProductDetail(999)
     print info.Name
except cdv.NotFound, e:
     print '*'*10, "Expected exception occured"
     print e.key, "NotFound"



Code of the server where the exception is raised:

# This is stub code

def getProductDetail(self, OID):
  print "getProductDetail() called in stub"
  if OID == 999: # the not found product
       raise cdv.NotFound(str(OID))
  imagef = open("image.gif", "r")
  image = imagef.read()
  imagef.close()
  info = cdv.product_info(OID, "Product Name in stub OID=" + str(OID),
image, 1)
  return info

Code of client call:

try:
     info = object_ref.getProductDetail(999)
     print info.Name
except cdv.NotFound, e:
     print '*'*10, "Expected exception occured"
     print e.key, "NotFound"

traceback of the error on the client:

Traceback (innermost last):
  File "./cdv_clt.py", line 45, in ?
    info = object_ref.getProductDetail(999)
  File "./cdvMgr_idl.py", line 252, in getProductDetail
    return _omnipy.invoke(self, "getProductDetail",
_0_cdv.ProductMgr._d_getProductDetail, args)
omniORB.CORBA.UNKNOWN: Minor: 0, Completed: COMPLETED_NO.