[omniORB] UserException
Steven W. Brenneis
brennes1@rjrt.com
Wed, 28 Jul 1999 14:44:19 -0400
agonne - Andrew Gonnet wrote:
>
> I can't get UserExceptions thrown in my implementation code to be
> returned to the client - all that happens is a SystemException is
> thrown at the client end. As far as I can tell, I'm doing what my
> Corba books and the Corba spec. say.
>
> Does anybody have example idl, C++ client and C++ implementation code
> showing how to use a class generated from an idl "exception"
> containing, say, a "short" and a "string", or similar?
>
> To be complete, I'm throwing the class generated from:
>
> exception MyException
> {
> short errorCode;
> string errorString;
> };
>
> using:
> throw MyException( 10, CORBA::string_dup( (const char*) "test" );
>
> when I get the SystemException thrown at the client.
>
> (The Client is on a NT4.0 PC compiled using VC++ V6.0 and the
> implementation on a Digital unix V4.0 (Rev. 1091) Compaq server
> compiled using cxx V6.1-029)
>
> Thanks,
>
> Andrew Gonnet
Do you use the raises keyword on the member function(s) which throw the
exception?
Example:
exception MyException {
short errorCode;
string errorString;
};
interface MyInterface {
void MyFunction()
raises(MyException);
};
The raises keyword lets IDL know that the function may throw a User
Exception and generates the appropriate code.