Re: [Saxdotnet-devel] Changing Exceptions in the API
Brought to you by:
jeffrafter,
kwaclaw
From: Karl W. <ka...@wa...> - 2004-12-07 19:21:46
|
> Currently in the .NET API there is redundancy wrt to exceptions: > > (1) SaxNotSupportedException and NotSupportedException > (2) SaxArgumentException and ArgumentException > > Should these be removed in favor of the .NET equivalents? I think there is actually no SAXArgumentException in the JAVA API. So we can remove it without much discussion. Mostly, .NET approaches exception handling differently. There are no checked exceptions, the "best practice" is to use the built-in exceptions, and only define your own if you cannot find an existing exception class that has adequate semantics. A good explanation (vs. checked exceptions) is in this article: http://www.artima.com/intv/handcuffs.html In our case here one can argue that the built-in NotSupportedException is meant to be used when a method is not implemented, whereas the SAXNotSupportedException is meant to be used for unsupported features and properties. For symmetry with the SAXNotRecognizedException we could therefore leave it in, but then we have the problem that unsupported extension methods (like IAttribute.IsDeclared) should rather throw a NotSupportedException. Tough choice, since having both could be confusing. Karl |