Skip to content

Commit

Permalink
Refactor log messages into HttpRequestHandlerImpl #250
Browse files Browse the repository at this point in the history
  • Loading branch information
alexandreBaronZnk committed Oct 26, 2020
1 parent 6453d5f commit bde3e7d
Showing 1 changed file with 3 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down

0 comments on commit bde3e7d

Please sign in to comment.