Return-Path: Delivered-To: apmail-jakarta-commons-dev-archive@apache.org Received: (qmail 54023 invoked from network); 1 Aug 2002 16:57:19 -0000 Received: from unknown (HELO nagoya.betaversion.org) (192.18.49.131) by daedalus.apache.org with SMTP; 1 Aug 2002 16:57:19 -0000 Received: (qmail 1360 invoked by uid 97); 1 Aug 2002 16:57:38 -0000 Delivered-To: qmlist-jakarta-archive-commons-dev@jakarta.apache.org Received: (qmail 1336 invoked by uid 97); 1 Aug 2002 16:57:37 -0000 Mailing-List: contact commons-dev-help@jakarta.apache.org; run by ezmlm Precedence: bulk List-Unsubscribe: List-Subscribe: List-Help: List-Post: List-Id: "Jakarta Commons Developers List" Reply-To: "Jakarta Commons Developers List" Delivered-To: mailing list commons-dev@jakarta.apache.org Received: (qmail 1313 invoked by uid 98); 1 Aug 2002 16:57:36 -0000 X-Antivirus: nagoya (v4198 created Apr 24 2002) Message-ID: From: "Jack, Paul" To: 'Jakarta Commons Developers List' Subject: RE: [Lang] Generic interface for handling exceptions Date: Thu, 1 Aug 2002 09:57:04 -0700 MIME-Version: 1.0 X-Mailer: Internet Mail Service (5.5.2653.19) Content-Type: text/plain; charset="iso-8859-1" X-Spam-Rating: daedalus.apache.org 1.6.2 0/1000/N X-Spam-Rating: daedalus.apache.org 1.6.2 0/1000/N > I wasn't saying that exception callbacks aren't useful. On the > contrary. I think it is a very worthwhile pattern to use. What > I am saying is that I don't like the generic application of that > pattern. I think it is much better to be specific to get the > benefits you list above (exact namings used and precise exception > type). > > An additional benefit is the ability to separate distinct types > of exception notifications. For example, if a component wants to > notify about two different exceptions, they would need to get two > different ThrowableHandler implementations, one for each. While > that may not seem so bad, consider a component that wants to notify > about 30. It's much easier to add a method than it is to add new > class implementations for each case. You'd only need a new class per exception if you wanted to do something different in each of the 30 cases, which would seem rare, but I do see your point. But I also see merit in having a generic interface; generic implementations can then be provided. (Eg, SMTPThrowableHandler that mails the exception to someone). The individual components could provide an adapter class that adapts their specific interface to the generic interface, so I could quickly install a handler that'd send me an email for each of the 30 cases. -Paul -- To unsubscribe, e-mail: For additional commands, e-mail: