Uncaught error on mutation
Hi!
I'm trying to catch rejected promise in mutation (onError) . But I get Uncaught error in promise.
Unless I wrap
await handleCreateGeneral(formData) with try/catch.
So the question is: Isn't onError supposed to catch that error? The toast is triggered but the error is propagated further
Thanks


3 Replies
optimistic-gold•2y ago
with
mutateAsync you need to catch errors, with mutate you don't. if you don't need the promise returned from mutateAsync - don't use it.optimistic-gold•2y ago
Mastering Mutations in React Query
Learn all about the concept of performing side effects on the server with React Query.
flat-fuchsiaOP•2y ago
Great! Thanks a lot ! 👍