
Originally Posted by
michi
Hmmm... I think this is problematic. For one, not all the properties on ApplicationException are virtual, and some of them are read-only. So, we would have to come up with a mapping that knows about each of these properties and does something appropriate. I don't like this very much, mainly because of its complexity and the difficulty of explaining it.
If the annotation is not workable, the Slice compiler should throw an error.
For example,
Code:
exception PBSError {
["dotNet:->Message(property, virtual, readonly)"]
string Reason;
};
If Message does not exist, or is neither virtual nor readonly, it is an error.

Originally Posted by
michi
Also, using a virtual property has the problem that, if an exception is passed as its base type, and the receiver uses the property, what it gets is the property of the base class, not the overridden implementation in the derived class. This can lead to rather surprising behavior.
True, if it originates as PBSError (see above) on the server, but the Slice for that operation only defines an ancestor (without the mapped member), then the receiver would not benefit from the mapping. Did I understand this correctly?

Originally Posted by
michi
I think the simple and pragmatic solution is to mangle the name of a Slice exception member if that name collides with a member of ApplicationException and its bases. But, before dismissing this out of hand, I'd like to at least consider it. I think I know what you mean, but could you post an example of what the generated code would look like, at least in outline?
Considering the Slice definition shown above (without annotation, of course), what I mean is as simple as adding this override, no other changes:
Code:
public override string Message {
get {
return Reason;
}
}
I really don't want to bother you too much. Its just so common to examine the message property of an exception, and its a surprise if its empty. Btw, normally exceptions constructed with no Message will have a default message assigned by .NET, but Ice.UserException has an empty message.
Anyway, as a "funny" side note: the current project I am working on - the first where we will be using ICE in production - has the purpose of wrapping a vendor's web services, since they turned out not to be as inter-operable as one would expect.
Karl