graphql/error
The graphql/error
module is responsible for creating and formatting GraphQL errors
graphql/error
module, or from the root graphql
moduleimport { GraphQLError } from "graphql"
When Apollo server encounters error while processing a GQL operation, it responds to a client with an errors
array containing each error that occurred.
Each error in the errors
array has an extensions
field that provides additional useful information
error code
or stracktrace
in development modeUse Apollo v5 in lieu of v4. V4 introduced a regression where an invalid variables result in 200 status code instead of 400 status code.
For example, when an input variable of String
is passed instead of Int
, the variable coercion will fail without explicitly throwing error.
null
or missing/incorrect fields on input objects