Why do I get an UnknownException?

Any proxy invocation in a client can result in an UnknownException or one of its two subclasses, UnknownUserException and UnknownLocalException. These exceptions indicate that the server raised an unknown exception:

  • UnknownUserException is raised if the server implementation throws an Ice user exception that isn't in the exception specification for the operation.
  • UnknownLocalException is raised if any Ice run-time exception (any exception derived from LocalException) other than ObjectNotExistException, FacetNotExistException and OperationNotExistException is thrown by the server implementation.
  • UnknownException is raised if any other exception is thrown by the server implementation. Typically, the server will give more information in the debug log if the property Ice.Warn.Dispatch has a non-zero value. Some language mappings, such as Java, also provide comprehensive information in the reason string.

You might wonder why there is an UnknownLocalException. The Ice run time knows all of the possible run-time exceptions, so why does it not return the true error to the caller? The primary reason is security: the Ice run time will not tell the client more than it needs to know. Another reason is that the client cannot do anything meaningful with more information. From a client-side perspective, you are interested in only two outcomes: did it work, or did it not work? If it didn't work, you need to know whether the problem is a client-side or a server-side issue. The run-time exceptions that are returned to the client allow you to make this decision; other details about the exception are a server-side concern, and therefore not provided to the client.

See Also