enapps-enorman commented on a change in pull request #6: URL: https://github.com/apache/sling-org-apache-sling-servlets-post/pull/6#discussion_r532800204
########## 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. > Maybe this would be a good time to do the extra work to identify those places and throw more specific exceptions? ---------------------------------------------------------------- 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: us...@infra.apache.org