HomeToolsAbout

Client Error Handling

What is it

Do not prematurely return, throw an explicit error such as 404

  • Prematurely returning a data will result in type drift instead (since it is a partial result)

Non-null argument in querying

The Non-Null type modifier (!) can also be used when defining arguments for a field, which will cause the GraphQL server to return a validation error if a null value is passed as that argument, whether in the GraphQL string or in the variables.

# query definition in front end query DroidById($id: ID!) { droid(id: $id) { name } } # client query param { "id": null } # returned result from GQL server { "errors": [ { "message": "Variable \"$id\" of non-null type \"ID!\" must not be null.", "locations": [ { "line": 1, "column": 17 } ] } ] }
AboutContact