graph-node
graph-node copied to clipboard
Error raised when a non-null field references a nonexistant entity is confusing
Suppose our schema looks like this:
type Account @entity {
id: ID!
}
type Thing @entity {
id: ID!
account: Account!
}
and we write a query:
{
thing(id: "123") {
account {
id
}
}
}
If our Thing
has a value for the account
field that does not correspond to the ID of any Account
(eg, a dangling reference), we get the error message "Null value resolved for non-null field account
", which sounds like the field itself is empty, rather than it referencing a nonexistent entity.
It'd be really helpful if these two common issues were distinguished between in the message.
part of handling field errors we should be returning the paths that should help lead to what field is raising the error