Re: How to design an exception architecture in a software?

From: Michael Borgwardt (brazil_at_brazils-animeland.de)
Date: 12/30/03


Date: Tue, 30 Dec 2003 17:37:24 +0100

Dave Glasser wrote:
>>Wherever it makes sense to handle different exceptions differently within
>>the application, use different exception classes so that you can make use
>>of catch clauses at the appropriate scope.
>
>
> A counterexample would be SQLException. You might handle a duplicate
> key exception differently than you would a hosed DB connection
> exception. To know which on you were dealing with, however, you would
> have to call getErrorCode() on the SQLException.

That's not really a counterexample to what I was saying. It is simply bad
design on the part of the API designers, resulting from a combination of
necessity and laziness.



Relevant Pages