Local and Dispatch Exceptions
Local Exceptions
The Ice runtime reports errors to the application by throwing exceptions. Ice occasionally throws standard exceptions such as std::invalid_argument
(C++) or IllegalArgumentException
(Java), but generally it throws exceptions derived from LocalException. These exceptions are known as local exceptions.
As far as Ice is concerned, the opposite of a local exception is a user exception. User exceptions are defined in Slice and derive from UserException; local exceptions are not defined in Slice and derive from LocalException
.
Even though user exceptions are nominally exceptions that you throw and catch, it’s better to think of them as error results. You may receive a user exception only when you make an invocation using a two-way proxy.
Dispatch Exceptions
When a API call throws an exception, this exception is necessarily thrown in the same program and address space as the caller. This exception can represent an error that was detected locally by the Ice runtime (for example, failed to establish a connection), or it can represent an error that was reported “over the wire” by a remote Ice server (for example, could not find a servant to dispatch this request to).
In the Ice exception type system, all these exceptions are local exceptions, derived from LocalException
. The exceptions that represent errors reported “over the wire” are a special kind of local exceptions, called dispatch exceptions.
A dispatch exception represents a failure that occurred in the server while dispatching an incoming request. If you get a dispatch exception, it means Ice was able to communicate with the server - and got a failure-response from the server.
You can only get a dispatch exception when you make an invocation with a two-way proxy.
A dispatch information carries information transmitted in a Reply message, namely:
a ReplyStatus enumerator
one or more fields that depend on the
ReplyStatus
enumerator
ReplyStatus | Associated Exception Class | Fields |
---|---|---|
|
|
|
|
| |
|
| |
|
|
|
|
| |
|
| |
| ||
| ||
Any other value greater than |
A dispatch exception without an associated exception class is an instance of DispatchException . The NotExist
and Unknown
exceptions all ultimately derive from DispatchException
.