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?