Syntax error
This error occurs if, while performing some specified operation, you provide wrong or unrecognized input data. The GraphQL checks the syntax as you write and, if you are trying to perform an operation which is unknown, you will be notified by the editor you are using. If you proceed with sending the request, you will get a syntax error. Below is an example of an error triggered by wrong syntax. The following query tries to fetch thefullName
field which doesn’t exist on the User
type:
Validation error
This type of error occurs when the user passes invalid data as the mutation input. For example, while creating a new user, you provide an email address that is already being used in another user’s account. It is therefore not unique and, as a result, you will get a validation error. Validation errors are part of the schema, which means that we need to include them in the query to get them explicitly. For example, in all mutations, they can be obtained through theerrors
field.
Below is an example of an error triggered by validation issues:
errors
field.
Permission error
This type of error occurs when you are trying to perform a specific operation but you are not authorized to do so; in other words, you have no sufficient permissions assigned. Below is an example of an error triggered by insufficient authorization. ThestaffUsers
query requires appropriate admin permissions: