cocoon-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Stephan Michels <step...@apache.org>
Subject Re: [RT] Checked exceptions considered harmful
Date Wed, 14 Apr 2004 08:18:14 GMT
Am Di, den 13.04.2004 schrieb Ugo Cei um 21:54:
> So, I'd like to make a proposal:
> 
> - use unchecked exceptions *by default* unless there's a good reason 
> otherwise, not just because that's the way it's always been done.
> 
> - wrap exceptions thrown by 3rd party packages (e.g. 
> org.xml.sax.SAXException) with Cocoon-specific, unchecked exceptions 
> (basicallly, abstain from throwing checked exceptions belonging to a 
> package different from the method's one, as this creates an unnecessary 
> dependence).
> 
> - write tests to verify that methods don't throw exceptions for valid 
> inputs and that they throw appropriate exceptions (e.g. 
> InvalidArgumentException) for invalid ones.
> 
> - document with a throws clause any unchecked exception that you 
> explicitly throw in a method, even if it's not required to do so. 
> Document it in the javadoc comment too.
> 
> - for the next release (2.1.5), reparent all exceptions now extending 
> CascadingException, to extend CascadingRuntimeException instead and 
> remove all the code that does nothing more than rethrow them.
> 
> - do the same for the Source package.
> 
> Now just give me time to don my asbesto suite before firing ;-)

Interesting approach! I see the benefits, if you compare it to
flowscript, where you mostly don't care about exception handling.
And if you want to, you can explicit catch the RuntimeExceptions.

+1

Stephan.


Mime
View raw message