graphene icon indicating copy to clipboard operation
graphene copied to clipboard

Returning non fatal errors alongside data

Open yairsilbermintz-aon opened this issue 2 years ago • 0 comments

I have a mutation that updates multiple records. In cases where some of the records would be invalid, I want to skip updating those records, update what records I can, and return a list of the ones that failed in the errors array

GraphQL has support for returning a partial response along with non fatal error information. Graphene already uses this in certain cases, such as an error accessing a specific subfield in a request.

There are docs for [https://docs.graphene-python.org/projects/django/en/latest/mutations/#simple-example](returning data from a successful mutation), and it is easy to return an error by raising an exception. But is there any way for me to return both from my mutation?

yairsilbermintz-aon avatar Jan 25 '24 18:01 yairsilbermintz-aon