Exceptions (was: RE: [Avalon4:PROPOSAL] Context Consensus)
"Leo Sutic" <[email protected]>
| Newsgroups | gmane.comp.jakarta.avalon.apps.devel,gmane.comp.jakarta.avalon.devel |
|---|---|
| Message-ID | <001501c2a14c$0654ea90$0801a8c0@Lagrange> |
> From: Noel J. Bergman [mailto:[email protected]] > > > I prefer for the component to [do] the cast and explode if > it fails. > > The responsibility is on the container to catch and log the > exception. > > The contract throws ContextException. There is nothing in > the API contract that says that a container must > intelligently handle ClassCastException, or what it might > mean semantically. True, but here we're really going into whether RuntimeExceptions should be tested for and caught. In the end I guess it just matters how much defensive programming you want to put in. Your example is too much for me to accept as a coding guideline, but if you want to write code that way... /LS