Closed frederikhors closed 3 years ago
I believe the proper handling case would be to fill the results array with the db error for each result element. This will allow you to propagate the error through to your resolver, which should return as a graph error.
As I understand, the data loader must return a result for every requested key.
As you know Graphql can return data alongside errors list.
For a list I can have:
With the code in your example I cannot understand how to do this and how to distinguish between an error to be returned in graphql and one to be returned as an error to make the program stop.
Example, given this code:
Let's say I get an error in
db.GetUsers()
and use that code I get this error instead:\n\t\t\tThe batch function supplied did not return an array of responses\n\t\t\tthe same length as the array of keys.\n\n\t\t\tKeys:\n\t\t\t[1 2]\n\n\t\t\tValues:\n\t\t\t[0xc000386600]\n\t\t"
for each element of the list.
So I need another way to handle this.
What do you suggest?