Home Help Center

java Ice.Exception, where is it?

iamwoodyjonesiamwoodyjones Member john smithOrganization: blahblahProject: blahblah
Platform:
Windows XP, Ice 3.1 Visual Studio 2005 version.


Perhaps I'm missing something but I am not able to use the Ice.Exception with Java. It's saying that it does not exist. I have been able to use it with C++ and C# but it seems to be missing from the Java version.

Comments

  • mesmes CaliforniaAdministrators, ZeroC Staff Mark SpruiellOrganization: ZeroC, Inc.Project: Ice Developer ZeroC Staff
    Hi,

    That's correct, the Java language mapping does not have Ice.Exception because we wanted user exceptions to derive from java.lang.Exception (and therefore be checked exceptions) whereas the Ice run time's local exceptions derive from java.lang.RuntimeException. If you want to catch all Ice exceptions or distinguish between user and local exceptions, you can structure your code as follows:
    try
    {
        ...
    }
    catch(Ice.UserException ex)
    {
    }
    catch(Ice.LocalException ex)
    {
    }
    
    Otherwise, you can trap all exceptions by catching java.lang.Exception.

    Take care,
    - Mark
Sign In or Register to comment.