Throwing error not resulting in react-query capturing 'error' state
Hello,
I have a POST function using fetch like:
And my invocation / use of that fetch function looks like:
And finally wrapped with react-query useMutataion
However, when I throw the error in post_sentry, react-query does not execute as expected. Any ideas what I am doing wrong?
3 Replies
ratty-blush•4y ago
Hi I think post_data should throw, not return an error
The test performed before creating the error also mixes response.ok() (bool) with a comparison to error status. Unsure this is expected
stormy-goldOP•4y ago
hey @glabat - Thanks for responding. Both were typos on my part distilling from codebase to writeup here. Issue persists even if I throw error with simple status code
Wondering if how I have composed all of this is some sort of anti-pattern?
Okay resolving this. I am actually stupid and was calling the function handleQuerySubmit instead of queryMutation.mutate() . Im dumb
ratty-blush•4y ago
👍