Child pages
  • Effective Exceptions
Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 2 Next »

Rethinking the SlingException

Status: DRAFT work in progress
Created: 23. December 2007
Author: fmeschbe

Inspired by Barry Ruzek's article Effective Java Exceptions, I went out to revisit the exceptions we have defined in the Sling API. This is what I came out with:

  • We have 4 Exceptions, all of which are checked exceptions
  • The SlingException is a base exception and is declared almost everywhere
  • The HttpStatusCodeException is an IOException not a SlingException and is not declared to be thrown anywhere
  • We have to documented possibilities of throwing a runtime exception: The AccessControlException possibly thrown when accessing a resource through the ResourceResolver.

Thinking about these (checked) Exceptions, I propose to change this situation as follows:

  1. The SlingException is a RuntimeException and is used as the base exception for all exceptions defined by the Sling API.
  • No labels