Re: [Saxdotnet-devel] Changing Exceptions in the API
Brought to you by:
jeffrafter,
kwaclaw
From: Karl W. <ka...@wa...> - 2004-12-12 05:34:05
|
Elliotte Harold wrote: > I don't know what really makes sense exception wise in .NET. It's > certainly plausible that you don't want to follow Java here. However > there is an important difference between the SAXNotSupportedException > and SAXNotRecognizedException, even if I always have trouble remembering > which is which. Hoping I don't get these backwards (as I often do), > SAXNotRecognizedException means that the parser will never allow you to > set or read this feature/property. It's simply not available in this > implementation. SAXNotSupportedException means something a little > different. Either > > 1. You can't read/write the value of this property at the current time, > but you might be able to later. For instance, you can't turn on > validation when you're halfway through parsing a document. Only before > you begin parsing a document or after you finish parsing one. > > 2. The specific value you tried to set is not supported. For instance, > you passed an object that does not implement LexicalHandler as the value > for the lexical-handler property, or you passed true for the validation > feature with a parser that does not validate. > > By contrast, you might see a SAXNotRecognizedException if you tried to > use a Xerces specific feature/property with AElfred or vice versa. > > It's a subtle distinction, but I do think it's valuable to maintain it. I think I pretty much understood these the same way. The question is, is it enough to differentiate these two types of situations through the error message alone? Which would mean that the difference is only useful for informational purposes. Or would you want to react to this difference through different behaviour in the application? I have difficulty coming up with a plausible scenario for that. In any case, the fact that the ArgumentException in .NET has a field for the parameter's name should be sufficient to make that distinction. If it refers to the feature's name then we have the equivalent of a SAXNotRecognizedException, if it refers to the value, then this is equivalent to a SAXNotSupportedException. Karl |