thefrontside / playhouse

Frontside's Backstage Portal
https://backstage.frontside.services/
25 stars 13 forks source link

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

Open webark opened 2 months ago

webark commented 2 months ago

I think I boilded it down to this..

https://github.com/thefrontside/playhouse/blob/460162e16c2c5d6569037a4ca0bfa56990a446c4/plugins/graphql-backend-module-catalog/src/relationDirectiveMapper.ts#L140-L142

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

https://github.com/thefrontside/playhouse/blob/460162e16c2c5d6569037a4ca0bfa56990a446c4/plugins/graphql-backend-module-catalog/src/entitiesLoadFn.ts#L28-L33

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?