From bde3e7d131c44e220a3f5faf7bf0e8d86c9ce7be Mon Sep 17 00:00:00 2001 From: Alexandre Baron Date: Mon, 26 Oct 2020 14:08:49 +0100 Subject: [PATCH] Refactor log messages into HttpRequestHandlerImpl #250 --- .../kickstart/servlet/HttpRequestHandlerImpl.java | 12 +++--------- 1 file changed, 3 insertions(+), 9 deletions(-) diff --git a/graphql-java-servlet/src/main/java/graphql/kickstart/servlet/HttpRequestHandlerImpl.java b/graphql-java-servlet/src/main/java/graphql/kickstart/servlet/HttpRequestHandlerImpl.java index 83b34da6..6582456d 100644 --- a/graphql-java-servlet/src/main/java/graphql/kickstart/servlet/HttpRequestHandlerImpl.java +++ b/graphql-java-servlet/src/main/java/graphql/kickstart/servlet/HttpRequestHandlerImpl.java @@ -37,28 +37,22 @@ public void handle(HttpServletRequest request, HttpServletResponse response) thr execute(invocationInput, request, response); } catch (GraphQLException e) { response.setStatus(STATUS_BAD_REQUEST); - log.info("Bad request: cannot create invocation input parser", e); + log.info("Bad request: cannot handle http request", e); throw e; } catch (Throwable t) { response.setStatus(500); - log.info("Bad request: cannot create invocation input parser", t); + log.error("Cannot handle http request", t); throw t; } } private void execute(GraphQLInvocationInput invocationInput, HttpServletRequest request, - HttpServletResponse response) { - try { + HttpServletResponse response) throws IOException { GraphQLQueryResult queryResult = invoke(invocationInput, request, response); QueryResponseWriter queryResponseWriter = QueryResponseWriter.createWriter(queryResult, configuration.getObjectMapper(), configuration.getSubscriptionTimeout()); queryResponseWriter.write(request, response); - } catch (Throwable t) { - response.setStatus(STATUS_BAD_REQUEST); - log.info("Bad GET request: path was not \"/schema.json\" or no query variable named \"query\" given"); - log.debug("Possibly due to exception: ", t); - } } private GraphQLQueryResult invoke(GraphQLInvocationInput invocationInput, HttpServletRequest request,