joerghoh commented on a change in pull request #6:
URL:
https://github.com/apache/sling-org-apache-sling-servlets-post/pull/6#discussion_r532736021
##########
File path:
src/main/java/org/apache/sling/servlets/post/impl/SlingPostServlet.java
##########
@@ -234,6 +235,11 @@ protected void doPost(final SlingHttpServletRequest
request,
} catch (ResourceNotFoundException rnfe) {
htmlResponse.setStatus(HttpServletResponse.SC_NOT_FOUND,
rnfe.getMessage());
+ } catch (final PersistenceException pe) {
+ log.warn("PersistenceException while handling POST "
+ + request.getResource().getPath() + " with "
+ + operation.getClass().getName(), pe);
+
htmlResponse.setStatus(HttpServletResponse.SC_METHOD_NOT_ALLOWED,"invalid POST
request");
Review comment:
There are many different types of errors (not having write permissions
on content is one of them), and the various types of operations do not clearly
distinguish between them, but always a PersistenceException. Also in quite some
cases the JCR API is not really granular and just throws RepositoryExceptions
if something is not working as expected.
So I tried to be generic and create a kind of universal "client side error".
If someone needs a more granular handling and support more types of client
errors.
What do you mean with
> Do you think we could add tests mocking real world issue
Do you see real world issues which would require a different handling?
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]