graph-node icon indicating copy to clipboard operation
graph-node copied to clipboard

Error raised when a non-null field references a nonexistant entity is confusing

Open Arachnid opened this issue 5 years ago • 1 comments

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.

Arachnid avatar May 18 '19 21:05 Arachnid

part of handling field errors we should be returning the paths that should help lead to what field is raising the error

saihaj avatar Feb 22 '24 15:02 saihaj