Hi folks,
The lack of reusability of failure conditions is a major pain point for us. I would like to see some way to set failure conditions or specify middleware on an entire Resource, instead of needing to individually set failure conditions or transformers on every single Query against the Resource.
A common pain point for GraphQL resources is that the endpoint always returns HTTP 200, so the client is unaware of errors when the query or mutation has failed.
The spec provides for a list of errors to be returned in the errors
parameter. GraphQL
Retool does provide failure conditions as a way to return errors given any custom criteria. This does solve the problem for individual queries, but it is a tedious and error-prone way to tackle the problem. (And frankly it's surprising that this is necessary, given that the GraphQL spec defines that this is the way endpoints should operate. Retool's GraphQL client is not really operating to spec by ignoring errors.)
If we miss adding the failure condition for just a single query, it results in silent failures when the resource returns an error, which is difficult to troubleshoot and frustrating for users.
Ideally, we would be able to either:
A. Create failure conditions that apply to an entire resource, across all of its queries
B. Create custom javascript middleware that operates on the results of a resource
Either of these options would allow us to tell Retool to look for items in the errors list. This would also be useful for anyone creating user-facing error objects inside the GraphQL data, which is a recommended pattern.
Thanks!