Closed Hardikraja closed 8 months ago
I found the answer of the above question,
@PostMapping(value = "/graphql")
public Map<String, Object> execute(@RequestBody Map<String, String> request, HttpServletRequest raw)
throws GraphQLException {
ExecutionResult result = graphQL.execute(request.get("query"));
return result; // it should return executionResult as it is
}
Earlier, I was returning executionResult.getData() instead of executionResult - that is why it was not working. Thanks.
Hello @kaqqao / SPQR team,
I am trying to implement SPQR in my project, it is a great tool that allows running graphql without schema.
I am having an issue in configuring exception handling with this. I went through all the issues/examples and found some solutions. But don't know that is not working.
See, here is how I configured my graphQL
This is the resolver I made (Here, I am intentionally throwing an exception)
And Here is how I created CustomExceptionHandler
And Here What I get for the query result
Request
Response
Please show me how can I configure in a way so that I get proper exception message in response.
To get the access of whole implementation you can refer to this branch -> https://github.com/Hardikraja/graphql-learning/tree/with-spqr
Thanks.