Archived
This forum has been archived. Please start a new discussion on GitHub.
Catching Custom Exceptions in Ruby
in Help Center
In C++ I throw an ID3::APALException(reason) exception which is declared in my slice file:
In ruby I catch the exception like this:
ex.message returns Ice::UnknownUserException, how can I get the correct ID3::APALException object and access the reason?
module ID3 { exception APALException { string reason; }; ... }
In ruby I catch the exception like this:
begin ... # code triggers APALException rescue => ex puts ex.message puts ex.backtrace end
ex.message returns Ice::UnknownUserException, how can I get the correct ID3::APALException object and access the reason?
0
Comments
-
Hi Peter,
Two possible reasons for an UnknownUserException are:
1) You didn't include APALException in the throws clause of your operation.
2) You didn't load the definition of APALException in your script.
If you are still having trouble, please describe your environment (Ice version, operating system, Ruby version, etc.), and provide a small example that we can use to reproduce the problem.
Regards,
Mark0 -
Thanks for your help Mark, 1) was the problem.
Cheers
Pete0