Run-Time Exceptions
Any operation invocation can raise a run-time exception. Run-time exceptions are pre-defined by the Ice run time and cover common error conditions, such as connection failure, connection timeout, or resource allocation failure. Run-time exceptions are presented to the application as native exceptions and so integrate neatly with the native exception handling capabilities of languages that support exception handling.
User Exceptions
A server indicates application-specific error conditions by raising user exceptions to clients. User exceptions can carry an arbitrary amount of complex data and can be arranged into inheritance hierarchies, which makes it easy for clients to handle categories of errors generically, by catching an exception that is further up the inheritance hierarchy. Like run-time exceptions, user exceptions map to native exceptions.
Inheritance Hierarchy for Exceptions
All the Ice run-time and user exceptions are arranged in an inheritance hierarchy, as shown below:
Inheritance structure for exceptions.
Ice::Exception
is at the root of the inheritance hierarchy. Derived from that are the (abstract) types Ice::LocalException
and Ice::UserException
. In turn, all run-time exceptions are derived from Ice::LocalException
, and all user exceptions are derived fromIce::UserException
.
This figures shows the complete hierarchy of the Ice run-time exceptions:
Ice run-time exception hierarchy. (Shaded exceptions can be sent by the server.)
| We use the Unified Modeling Language (UML) for the object model diagrams (see [1] and [2] for details). |
Note that Ice run-time exception hierarchy groups several exceptions into a single box to save space (which, strictly, is incorrect UML syntax). Also note that some run-time exceptions have data members, which, for brevity, we have omitted in the Ice run-time exception hierarchy. These data members provide additional information about the precise cause of an error.
Many of the run-time exceptions have self-explanatory names, such as MemoryLimitException
. Others indicate problems in the Ice run time, such as EncapsulationException
. Still others can arise only through application programming errors, such asTwowayOnlyException
. In practice, you will likely never see most of these exceptions. However, there are a few run-time exceptions you will encounter and whose meaning you should know.