jose-correia commented on code in PR #59:
URL: 
https://github.com/apache/sling-org-apache-sling-distribution-core/pull/59#discussion_r887636626


##########
src/main/java/org/apache/sling/distribution/servlet/DistributionAgentServlet.java:
##########
@@ -71,7 +73,7 @@ protected void doPost(SlingHttpServletRequest request, 
SlingHttpServletResponse
                 log.debug("distribution response : {}", distributionResponse);
             } catch (Throwable e) {
                 log.error("an unexpected error has occurred", e);
-                ServletJsonUtils.writeJson(response, 503, "an unexpected error 
has occurred", null);
+                ServletJsonUtils.writeJson(response, 503, e.getMessage(), 
null);

Review Comment:
   Agree that the status code is not ideal. However, I think Christian is 
right. I will track this in a JIRA issue, to be assessed later, since it falls 
outside of the main purpose of this PR.
   
   Regarding the exception narrowing, even though I agree, the current 
implementation makes it very hard to do such a thing. If you look at the [code 
that we are 
executing](https://github.com/apache/sling-org-apache-sling-distribution-journal/blob/master/src/main/java/org/apache/sling/distribution/journal/impl/publisher/DistributionPublisher.java#L267)
 it is catching a generic `Exception` and raising this `DistributionException`, 
which can contain any type of error message, and we cannot be sure which.
   
   We need to discuss how can we include maybe more properties in this 
`DistributionException` which would help an upper module decide the severity 
and type of error.



-- 
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.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to