With the go API for Google App Engine I try to retrieve a non-existent object:
func entityKey(c appengine.Context, name string) *datastore.Key {
collectionKey := datastore.NewKey(c, "EntityCollection", "default_entitycollection", 0, nil)
return datastore.NewKey(c, "Entity", name, 0, collectionKey)
}
//.....
var record EntityRecord // Some random type
key := entityKey(context, "This key does not exist")
err := datastore.Get(context, key, &record)
It returns the error:
datastore: internal error: server returned the wrong number of entities
Whereas I expect the much more obvious ErrNoSuchEntity
. What gives?
This is on the local development server.