why client cannot catch user-defined exception in AMI mode?

in Help Center
I define an interface :
interface myI {
["ami"] int myOP(string s) throw myEx ;
}
but I just find ice_exception(const ::Ice::Exception&)
How could I catch "myEx" in callback object?
Why not ice_exception(const myEx&)??
my env : c++ , Ice-2.1.0 , linux
many thanks !
interface myI {
["ami"] int myOP(string s) throw myEx ;
}
but I just find ice_exception(const ::Ice::Exception&)
How could I catch "myEx" in callback object?
Why not ice_exception(const myEx&)??
my env : c++ , Ice-2.1.0 , linux
many thanks !
0
Comments
I re-throw the exception with ex->ice_throw.
try{
ex->ice_throw();
}
catch(myEx e)
{
//go to bed
}
catch(::Ice::Exception e)
{
//watch TV
}
I have never gone to bed ....
can you give a sample code ?
This should work. Try for example to modify the client from the demo/Ice/async demo (available in Ice 3.2.0). Change the implementation of the AMI callback ice_exception method to:
Then run the client against the server and type "d" followed by "s" to shutdown server and get it to cancel the delayed request. You'll see that the exception is correctly catch by the client and the client will display "request failed!".
Also, note that you should catch exceptions by reference not value, so your code should look like the following:
Cheers,
Benoit.