-
Notifications
You must be signed in to change notification settings - Fork 317
FieldAccessException should include field as well as global errors in its message #348
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
Comments
On closer look, I am unable to reproduce and I can't see why it's happening. If you look at the line where the exception is raised, the response must be invalid of there is a field error. The former is defined as "data" is not present or Could you please, either debug further based on this information to understand why it's raising the error, or provide a sample? Also, try using the latest snapshot, just in case. |
@rstoyanchev thanks, I'll double check if Also in your tests, were you using M6 or what version to recreate? |
Confirmed that it's only |
Ok, and I was finally able to recreate it, but the response was only {
"errors": [
{
"message": "401: Unauthorized",
"extensions": {
"code": "UNAUTHENTICATED"
},
"code": "UNAUTHENTICATED"
}
],
"data": null,
"extensions": {
"tracing": {
"version": 1,
"startTime": "2022-04-21T14:46:53.732Z",
"endTime": "2022-04-21T14:46:53.752Z",
"duration": 20235956,
"execution": {
"resolvers": []
}
}
}
} Confirmed we get the same error in We're trapping and rethrowing like so: .onErrorMap { error ->
if (error is GraphQlTransportException && error.cause is WebClientResponseException) {
val responseBody = (error.cause as WebClientResponseException).responseBodyAsString
GraphQLException("GraphQL call failed, ${error.message}, responseBody: $responseBody")
} else if (error is FieldAccessException) { // This is the new case for the above response
GraphQLException("GraphQL call failed, ${error.message}, responseBody: ${error.response}")
} else {
logger.error("Unhandled GraphQl Error, type was ${error.javaClass}")
error
}
} Given this, I think we can close this, thanks! |
On closer look, it's true that |
When making a GraphQl Client call to a field that returns a list of an entity, when then list is empty, we're getting the following error:
Version:
implementation("org.springframework.graphql:spring-graphql:1.0.0-M6")
Calling Code:
Failing response:
Successful response:
I would not expect an empty array to result in an error, when it still technically follows the schema, additionally, the error thrown is very misleading, since the field
getRefillNumbers
is still there.The text was updated successfully, but these errors were encountered: