[omniORB] Throw Exceptions

Onopin Mikhail kool@garant.ru
Wed, 19 Dec 2001 18:35:45 +0300


Hello all!

idl code:

exception Ex {};

interface A{
    void a();
};
interface B{
    void b();
};
interface C{
    void c() raises Ex;
};

My problem in comment in follow cpp code:

void A::a()
{
    // Here i want to catch Ex wich throws C::c().
    try {
        B::b();
    } catch(Ex) {
        ...
    }
}

void B::b()
{
    // Here i must catch exception (because the method C::c() declared as
thrown), but i don't want it!
    C::c();
}

void C::c() throw Ex
{
    throw new Ex();
}

Posible solution for this, is write new code:

void B::b() throw CORBA::UserException
{
    // Now ok! Because this method declared as thrown base class of Ex!
    C::c();
}

But in IDL i can't write:
interface B{
    void b() raises CORBA::UserException;
};