Local and Dispatch Exceptions
3 min read
3 min read
3 min read
3 min read
3 min read
3 min read
3 min read
3 min read
3 min read
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 LocalExceptionLocalExceptionLocalExceptionLocalExceptionLocalExceptionLocalExceptionLocalExceptionLocalExceptionLocalException. 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 UserExceptionUserExceptionUserExceptionUserExceptionUserExceptionUserExceptionUserExceptionUserExceptionUserException; local exceptions are not defined in Slice and derive from LocalException.
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.
A dispatch information carries information transmitted in a Reply message, namely:
- a ReplyStatusReplyStatusReplyStatusReplyStatusReplyStatusReplyStatusReplyStatusReplyStatusReplyStatus enumerator
- one or more fields that depend on the
ReplyStatusenumerator
| ReplyStatus | Associated Exception Class (if any) | Fields |
|---|---|---|
ObjectNotExist | ObjectNotExistException | Identity id string facet string operation |
FacetNotExist | FacetNotExistException | Identity id string facet string operation |
OperationNotExist | OperationNotExistException | Identity id string facet string operation |
UnknownLocalException | UnknownLocalException | string message |
UnknownUserException | UnknownUserException | string message |
UnknownException | UnknownException | string message |
InvalidData | ||
Unauthorized | ||
Any other value greater than Unauthorized |
A dispatch exception without an associated exception class is an instance of DispatchExceptionDispatchExceptionDispatchExceptionDispatchExceptionDispatchExceptionDispatchExceptionDispatchExceptionDispatchExceptionDispatchException. The NotExist and Unknown exceptions all ultimately derive from DispatchException.