Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error message when an relation entity doesn't exist #409

Open
webark opened this issue Sep 11, 2024 · 0 comments
Open

Error message when an relation entity doesn't exist #409

webark opened this issue Sep 11, 2024 · 0 comments

Comments

@webark
Copy link

webark commented Sep 11, 2024

I think I boilded it down to this..

(await loader.loadMany(ids.map(node => node!.id))).forEach(
(entity, index) => !entity && (ids[index] = null),
);

which it seems should not just be testing !entity cause with the loading function.

refEntries.forEach(
([key], index) =>
(entities[key] =
result.items[index] ??
new GraphQLError(`no such entity with ref: '${queries[index]}'`)),
);

that maybe it should be testing to see if it's an instance of the Graphql Error?

Or are you intending to bubble that up?

The error that is shown there is

Abstract type \"Owner\" must resolve to an Object type at runtime for field \"OpaqueComponent.owner\". Either the \"Owner\" type should provide a \"resolveType\" function or each possible type should provide an \"isTypeOf\" function.

cause the entity is actually

{
  __source: 'Catalog',
  message: "no such entity with ref: '[object Object]'",
  path: undefined,
  locations: undefined,
  extensions: [Object: null prototype] {}
}

which is the result of the GraphQLError

I'm open to open a PR, but should I just add a instance of GraphQLError check where we are just checking for the !entity?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant