# How to return error with Lambda resolver

**URL:** <https://discuss.dgraph.io/t/how-to-return-error-with-lambda-resolver/12100>\
**Category:** Dgraph Cloud / Slash GraphQL\
**Tags:** kind:feature, lambda\
**Created:** [December 28, 2020, 5:45pm UTC](https://discuss.dgraph.io/t/how-to-return-error-with-lambda-resolver/12100 "2020-12-28T17:45:38Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![amaster507](https://yyz1.discourse-cdn.com/flex007/user_avatar/discuss.dgraph.io/amaster507/32/4123_2.png) [@amaster507](https://discuss.dgraph.io/u/amaster507)\
**Post date:** [December 28, 2020, 5:45pm UTC](https://discuss.dgraph.io/t/how-to-return-error-with-lambda-resolver/12100/1 "2020-12-28T17:45:38Z")

</div>

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?

---

<div class="post-metadata">

**Author:** ![Isak](https://avatars.discourse-cdn.com/v4/letter/i/ac91a4/32.png) [@Isak](https://discuss.dgraph.io/u/Isak)\
**Post date:** [January 24, 2021, 12:45am UTC](https://discuss.dgraph.io/t/how-to-return-error-with-lambda-resolver/12100/2 "2021-01-24T00:45:31Z")

</div>

Did you find a solution?

---

<div class="post-metadata">

**Author:** ![amaster507](https://yyz1.discourse-cdn.com/flex007/user_avatar/discuss.dgraph.io/amaster507/32/4123_2.png) [@amaster507](https://discuss.dgraph.io/u/amaster507)\
**Post date:** [January 24, 2021, 2:30am UTC](https://discuss.dgraph.io/t/how-to-return-error-with-lambda-resolver/12100/3 "2021-01-24T02:30:28Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![iyinoluwaayoola](https://yyz1.discourse-cdn.com/flex007/user_avatar/discuss.dgraph.io/iyinoluwaayoola/32/4282_2.png) [@iyinoluwaayoola](https://discuss.dgraph.io/u/iyinoluwaayoola)\
**Post date:** [March 24, 2021, 3:25pm UTC](https://discuss.dgraph.io/t/how-to-return-error-with-lambda-resolver/12100/4 "2021-03-24T15:25:10Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![maaft](https://avatars.discourse-cdn.com/v4/letter/m/4af34b/32.png) [@maaft](https://discuss.dgraph.io/u/maaft)\
**Post date:** [April 28, 2021, 10:42am UTC](https://discuss.dgraph.io/t/how-to-return-error-with-lambda-resolver/12100/5 "2021-04-28T10:42:51Z")

</div>

[@graphql](https://discuss.dgraph.io/groups/graphql) Can this please be looked at? It’s very important I think!
