Global failure conditions for a whole resource

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.



A feature like that would be super helpful for my team as well! Right now, we're copy-pasting a transformer that deals with GraphQL errors into every single of our query calls and it's getting pretty messy, we've been getting quite some support requests from users that didn't get an error message from our retool app.

Thank you for this feedback! I posted this internally as well. I'll share any updates on this thread :blush:

This is strongly needed, the graphql spec encourages sending a 200 (with an errors array) thus is dangerous when crafting apps in Retool that have several queries/mutations since the default behaviour is to swallow the error.