[omniORB] Exceptions in Any

Alex Hornby alex@anvil.co.uk
Fri, 7 May 1999 16:55:28 +0100 (BST)


I have been trying to put an exception into an Any, in order to read
it's typecode, all in order to produce the Exception ostream insertor
from Henning and Vinoski.

Does anyone have either: a solution for the insertion of an exception
into aan Any, OR a working ostream insertor for exceptions?

Here is the code from the book:

ostream&
operator<<(ostream & os, CORBA::Exception & e)
{
    CORBA::Any tmp;
    tmp <<= e;

    CORBA::TypeCode_var tc = tmp.type();
    const char * p = tc->name();
    if (*p != '\0')
        os << p;
    else
        os << tc->id();
    return os;
}