You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@sling.apache.org by "Konrad Windszus (Jira)" <ji...@apache.org> on 2022/07/19 09:33:00 UTC

[jira] [Created] (SLING-11464) GraphQLServlet: Don't wrap arbitrary Exceptions in IOExceptions

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)