Re: [Saxdotnet-devel] Changing Exceptions in the API
Brought to you by:
jeffrafter,
kwaclaw
From: Karl W. <ka...@wa...> - 2004-12-12 01:56:27
|
Karl Waclawek wrote: >>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. In the .NET line of thinking we should probably get rid of both, the SAXNotSupportedException and SAXNotRecognizedException, as in both cases, what you really have is an invalid argument (the name of a property or feature), which therefore should throw a standard ArgumentException with a message (or code) indicating "not supported" or "not recognized". How significant is the difference anyway? Karl |