Konrad Windszus created SLING-11464:
---------------------------------------

             Summary: GraphQLServlet: Don't wrap arbitrary Exceptions in 
IOExceptions
                 Key: SLING-11464
                 URL: https://issues.apache.org/jira/browse/SLING-11464
             Project: Sling
          Issue Type: Improvement
          Components: GraphQL
            Reporter: Konrad Windszus


In both {{execute}} methods there is an {{IOException}} being thrown in 
https://github.com/apache/sling-org-apache-sling-graphql-core/blob/9989848de947bb4dc320b6b0f7cbcde810819728/src/main/java/org/apache/sling/graphql/core/servlet/GraphQLServlet.java#L323
 and 
https://github.com/apache/sling-org-apache-sling-graphql-core/blob/9989848de947bb4dc320b6b0f7cbcde810819728/src/main/java/org/apache/sling/graphql/core/servlet/GraphQLServlet.java#L336
 wrapping the underlying exception.

That is unexpected as {{IOException}} doesn't change the response status (i.e. 
stays with default 200) and also doesn't leverage the Sling error handler for 
rendering a response. Instead in most cases a blank response will hit the 
client.

{{IOException}} should only be thrown in case one cannot write to the 
underlying servlet response stream/writer. For all other cases other exception 
classes should be used!



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to