Hi,
I am wondering what the internal API contract is between the Sling
framework code (that will handle those exceptions and set the
appropriate status code in the HTTP response header) and the servlet/
script code (that knows when to throw exceptions):
Should it mimic the HTTP/REST style interface as much as possible (aka
throwing exceptions must follow the HTTP status codes) or are there
additionitial features that go beyond the HTTP protocol?
In the first case Sling is then acting somewhat like a HTTP proxy
(helping in conversion from HTTP headers to Java code). I think we
need a clear API design goal when making a decision for the error
handling API. There are also error cases that are handled by Sling
itself or by utility classes - should they use the same API or are
they different?
Apart from this, I think a method will always look "nicer" (at least
to me) and also be shorter:
sendError(404, "Not found: " + path)
sendNotFoundError(path)
vs.
throw new ResourceNotFoundException(path)
Just my 2 cents
Alex
--
Alexander Klimetschek
[EMAIL PROTECTED]