[omniORB] Narrowing DII exception - take 2

Duncan Grisby dgrisby@uk.research.att.com
Tue, 07 Aug 2001 10:45:41 +0100


On Monday 30 July, Kevin Bailey wrote:

> I'm still trying to find the right way to propagate a user exception
> through a DII request. I suspect the included example is closer to
> the correct way than before but it still translates all user exceptions
> to CORBA::MARSHAL.

You're almost there. You've just missed out one important thing...

> void DII_Evoke(Fruit::Pingable_ptr r_pingable)

You probably mean "invoke", rather than "evoke", but that isn't the
problem...

> {
>   CORBA::Request_var r_request = r_pingable->_request("Ping");
>   r_request->invoke();

  r_request->exceptions()->add(Fruit::_tc_MyUserException);

You have to give the request the list of possible user exception
TypeCodes, otherwise it doesn't know how to unmarshal the exception
when it arrives.

Once you've done that, you'll successfully downcast to
UnknownUserException, where you can use the Any extraction to get your
actual exception.

Cheers,

Duncan.

-- 
 -- Duncan Grisby  \  Research Engineer  --
  -- AT&T Laboratories Cambridge          --
   -- http://www.uk.research.att.com/~dpg1 --