How to return error with Lambda resolver

I am writing a lambda query resolver function to run a few GraphQL queries and order the results and then return a list. However, in some cases, I want to return a custom error from the resolver function. How can I do that?

2 Likes

Did you find a solution?

The only thing I came up with so far, is to create a Payload for the lambda query that can contain an error message and then return that message.

1 Like

This is a workaround since it doesn’t follow the GraphQL spec for reporting errors. Plus it doesn’t work for @lambda fields. Fixing this will make it much easier to debug and improve the API user experience.

1 Like

@graphql Can this please be looked at? It’s very important I think!