Closed
Description
When using a nested path selection and the query throws an exception, it fails with a PathNotFoundException
instead of it returning the response error.
For example, for a test with the following;
client.documentName("TaxRateMutationSpec")
.execute()
.path("makeTaxRateDefault.taxRate.id").isEqualTo(taxRateId)
It would fail with:
Response has 1 unexpected error(s) of 1 total. If expected, please filter them out: [{message=The field at path '/makeTaxRateDefault/merchant' was declared as a non null type, but the code involved in retrieving data has wrongly returned a null value. The graphql specification requires that the parent field be set to null, or if that is non nullable that it bubble up null to its parent and so on. The non-nullable type is 'Merchant' within parent type 'MakeTaxRateDefaultPayload', path=[makeTaxRateDefault, merchant], extensions={classification=NullValueInNonNullableField}}]
But when the test uses a nested path like so (rudimentary example):
client.documentName("TaxRateMutationSpec")
.execute()
.path("makeTaxRateDefault.taxRate") {
it.path("id").isEqualTo(taxRateId)
}
The error output is:
com.jayway.jsonpath.PathNotFoundException: Expected to find an object with property ['makeTaxRateDefault'] in path $['data'] but found 'null'. This is not a json object according to the JsonProvider: 'com.jayway.jsonpath.spi.json.JacksonJsonProvider'.
I guess the response should be checked for errors before trying to parse the json?