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 anIOException
not aSlingException
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 theResourceResolver
.
Thinking about these (checked) Exceptions, I propose to change this situation as follows:
- The
SlingException
is aRuntimeException
and is used as the base exception for all exceptions defined by the Sling API.