Each Slice exception is mapped to a Java class with the same name. For each data member, the corresponding class contains a public data member. (Obviously, because
BadTimeVal and
BadZoneName do not have members, the generated classes for these exceptions also do not have members.) Refer to
Section 10.15.4 for additional information on data members.
Exceptions have a default constructor as well as a second constructor that accepts one argument for each exception member. This constructor allows you to instantiate and initialize an exception in a single statement, instead of having to first instantiate the exception and then assign to its members. For derived exceptions, the constructor accepts one argument for each base exception member, plus one argument for each derived exception member, in base-to-derived order.
Each exception also defines the ice_name member function, which returns the name of the exception.
All user exceptions are derived from the base class Ice.UserException. This allows you to catch all user exceptions generically by installing a handler for
Ice.UserException.
Ice.UserException, in turn, derives from
java.lang.Exception.
Ice.UserExceptions implements a
clone method that is inherited by its derived exceptions, so you can make memberwise shallow copies of exceptions.
Note that the generated exception classes contain other member functions that are not shown. However, those member functions are internal to the Java mapping and are not meant to be called by application code.