Table of Contents Previous Next
Logo
Client-Side Slice-to-C++ Mapping : 6.10 Mapping for Run-Time Exceptions
Copyright © 2003-2010 ZeroC, Inc.

6.10 Mapping for Run-Time Exceptions

The Ice run time throws run-time exceptions for a number of pre-defined error conditions. All run-time exceptions directly or indirectly derive from Ice::LocalException (which, in turn, derives from Ice::Exception). Ice::LocalException has the usual member functions (ice_name, ice_clone, ice_throw, and (inherited from Ice::Exception), ice_print, ice_file, and ice_line).
An inheritance diagram for user and run-time exceptions appears in Figure 4.4 on page 117. By catching exceptions at the appropriate point in the hierarchy, you can handle exceptions according to the category of error they indicate:
• Ice::Exception
This is the root of the complete inheritance tree. Catching Ice::Exception catches both user and run-time exceptions.
• Ice::UserException
This is the root exception for all user exceptions. Catching Ice::UserException catches all user exceptions (but not run-time exceptions).
• Ice::LocalException
This is the root exception for all run-time exceptions. Catching Ice::LocalException catches all run-time exceptions (but not user exceptions).
• Ice::TimeoutException
This is the base exception for both operation-invocation and connection-estab­lishment timeouts.
• Ice::ConnectTimeoutException
This exception is raised when the initial attempt to establish a connection to a server times out.
For example, a ConnectTimeoutException can be handled as ConnectTimeoutException, TimeoutException, LocalException, or Exception.
You will probably have little need to catch run-time exceptions as their most-derived type and instead catch them as LocalException; the fine-grained error handling offered by the remainder of the hierarchy is of interest mainly in the implementation of the Ice run time. An exception to this rule are FacetNotExistException (see Chapter 33) and ObjectNotExistException (see Chapter 34), which you may want to catch explicitly.

Table of Contents Previous Next
Logo