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

Compare with Current View Page History

Version 1 Next »

Rethinking the SlingException

Status: DRAFT
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