Errors and Non-Nullability
If an error is thrown while resolving a field, it should be treated as though the field returnednull, and an error must be added to the"errors"list in the response.
If the result of resolving a field isnull(either because the function to resolve the field returnednullor because an error occurred), and that field is of aNon-Null
type, then a field error is thrown. The error must be added to the"errors"list in the response.
If the field returnsnullbecause of an error which has already been added to the"errors"list in the response, the"errors"list must not be further affected. That is, only one error should be added to the errors list per field.
SinceNon-Null
type fields cannot benull, field errors are propagated to be handled by the parent field. If the parent field may benullthen it resolves tonull, otherwise if it is aNon-Null
type, the field error is further propagated to it’s parent field.
If all fields from the root of the request to the source of the error returnNon-Null
types, then the"data"entry in the response should benull.