Hi everyone,
I'm working on a NestJS GraphQL resolver and I need some help. I want to return a list of OrganisationType objects, but I also want to include errors in the response if some identifiers don't exist. Here's my current resolver method:
@ResolveField('getList', () => OrganisationType])
async getList(
@Args('where', { type: () => OrganisationTypeGetListInputType })
where:OrganisationTypeGetListInputType,
): Promise<OrganisationType[]> {
return this.dataProductDataloader.dataloaderByDocId.loadMany(where?.identifiers);
}
I know the GraphQL protocol allows for errors, but I don't want to explicitly add them to the schema. How can I modify this method to return both the list of OrganisationType and any errors encountered during the lookup? Thanks in advance!