Skip to content

Commit

Permalink
Merge pull request #275 from alexandreBaronZnk/bugfix/250-httprequest…
Browse files Browse the repository at this point in the history
…handlerimpl-doesnt-reponse-error-with-detail

Refactor log messages into HttpRequestHandlerImpl #250
  • Loading branch information
oliemansm authored Nov 13, 2020
2 parents 6453d5f + bde3e7d commit 6451779
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 6451779

Please sign in to comment.