[omniORB] Accessing the error message associated with an exception
Len Holgate (Mail List Account)
Mail-lists@dial.pipex.com
Thu, 7 Jun 2001 23:03:49 +0100
I found that a problem too, I ended up using some code something like this
to get around it...
#ifndef __OMNIORB_USEREXCEPTION_H__
#include <omniORB3/userexception.h>
#endif
/**
* Obtain the name of the exception that's been thrown.
* We reuse an Omni orb macro that executes a supplied macro for
* each of the CORBA exceptions.
*/
#define DoThis(_ex) \
if (CORBA::_ex::_narrow(const_cast<CORBA::Exception *>(&e))) \
{ \
return "CORBA::" #_ex; \
} \
/**
* Get the name of a CORBA::Exception as a string.
* Uses some rather horrible macros to generate a text string from a
CORBA::Exception.
*/
static std::string GetNameFromCORBAException(const CORBA::Exception &e)
{
OMNIORB_FOR_EACH_SYS_EXCEPTION(DoThis)
if (CORBA::UserException::_narrow(const_cast<CORBA::Exception *>(&e)))
{
return "CORBA::UserException";
}
return "Unrecognised CORBA::Exception!";
}
----- Original Message -----
From: "Bruce Fountain" <B_Fountain@motherwell.com.au>
To: <omniorb-list@uk.research.att.com>
Sent: Thursday, June 07, 2001 5:25 PM
Subject: [omniORB] Accessing the error message associated with an exception
> Hello again,
>
> I may be missing something obvious, but is there no method
> to convert a CORBA::SystemException to a string message? The
> other ORBs I have used have had some proprietory method like
> _to_string() or reason(). Is there some way of looking up the
> message using the minor() id?
>
> Bruce Fountain
> Mi Consulting Group (Australia) Pty Ltd
> Direct Line: +61 (0)8 9368 8607
> Switchboard: +61 (0)8 9368 8600
> Facsimile: +61 (0)8 9368 8699
> E-mail: bruce.fountain@mi-services.com
>