GraphQL error policy

I am in of wanting to change the error policy within graphql

See the following docs:

I would like to change it to “all” instead of the default “none”.

I am finding that the useQuery from @redwoodjs/web does not allow me to change this option - or atleast it does not take effect

Any suggestions?

I’d plug in my own version of useQuery, with that option already set. Throw out <RedwoodApolloProvider> and do manually what that one does.

See here for an example Switching to Another GraphQL Client in RedwoodJS | Tobbe Lundberg's place on teh Intarwebs

@Tobbe is this the only way to set the error policy? This method also seems to set it globally.

Had to have a look at the code.

So RW’s useQuery does take a second options parameter. So you should be able to do this

useQuery(MY_QUERY, { errorPolicy: 'all' });

BUT if you’re using cells, you have to set it using beforeQuery

1 Like