Hi,

Am Samstag, den 29.12.2007, 12:06 -0800 schrieb Padraic Hannon:
> to make those extend IOException and thus not be a runtime exception?  

Another point regarding IOException: As noted in the Effective
Exceptions paper [1], the IOException would probably better be a
RuntimeException. We could - for Sling - define SlingIOException
(extends SlingException) to wrap IOException and SlingServletException
(extends ServletExcdeption) to wrap ServletException.

This way these exceptions could be sent from where they are thrown up to
the outermost Sling main servlet, which handles them by handling them
appropriately or rethrowing them as the original exception.

We actually do the same for the Java Script API ScriptException, which
we wrap in a ScriptEvaluationException.

I updated the whiteboard API proposal and wiki page with these two
exceptions.

Regards
Felix

[1] http://dev2dev.bea.com/pub/a/2006/11/effective-exceptions.html

> I am unsure about the parent class, but I do agree that probably  
> should not be a Runtime exception since it is something that a program  
> would care about.
> 
> -paddy
> 
> On Dec 29, 2007, at 11:58 AM, Felix Meschberger wrote:
> 
> > Hi all,
> >
> > Prompted by a blog by Alexander Klimetschek [1] and a very interesting
> > paper on exceptions [2] I set back to think about the exceptions in  
> > the
> > Sling API and wrote a wiki page on this subject [3].
> >
> > To summarize, we should make the SlingException a RuntimeException and
> > all exceptions defined in the Sling API extend SlingException.  
> > Together
> > with appropriate catching inside Sling itself (letting  
> > RuntimeExceptions
> > pass through generally) this should help us streamline exception
> > handling.
> >
> > A prototype API definition may be found in the whiteboard at [4].
> >
> > What do you think ?
> >
> > Regards
> > Felix
> >
> > [1]
> > http://weblogs.goshaky.com/weblogs/alexkli/entry/exception_best_practices
> > 
> > [3] http://cwiki.apache.org/SLING/effective-exceptions.html
> > [4]
> > http://svn.apache.org/repos/asf/incubator/sling/whiteboard/fmeschbe/effective_exceptions
> 

Reply via email to