This forum has been archived. Please start a new discussion on GitHub.

A question about Exception hierarchy in Ice

If an operation implementation raises a run-time exception other than
ObjectNotExistException, FacetNotExistException, or
OperationNotExistException (such as a NotRegisteredException), the
client receives an UnknownLocalException. In other words, the Ice protocol
does not transmit the exact exception that was encountered in the server, but
simply returns a bit to the client in the reply to indicate that the server encountered
a run-time exception.

Suppose an operation throws an CompressionNotSupportedException on the server side, then the client will get an UnknownLocalException and know nothing about CompressionNotSupportedException.

My suggestion:
Since every exception has an unique name(eg. CompressionNotSupportedException's name is "Ice::CompressionNotSupportedException"), it's better that if we can transfer this information to the client. It needs little change to Ice:
class ICE_UTIL_API Exception
	void ice_setRealName(const char* realName)
		  _realName = realName;

	char * ice_getRealName()
		  return _realName;
    const char* _realName;
    before we replace CompressionNotSupportedException(ex_1) with UnknownLocalException(ex_2), we can do like this:

catch {const UnknownLocalException& ex)
	cout << "The exception " << ex.ice_getRealName() << " is caught" << endl;


  • benoit
    benoit Rennes, France
    If you take a closer look at the definition of Ice::UnknownException (in Ice-2.1.1/slice/Ice/, we actually transfer the stringified representation of the exception in the "unknown" field.

  • Great :p , Thank you!