T
TanStack10mo ago
metropolitan-bronze

Throw only specific errors

Hey I was wondering how I can throw only specific errors. Some errors I receive from my API I have setup to spawn a toast with an error message using global onError hanfdlers, but I want the other errors to be thrown so they can be caught by the error boundary. The issue is that if I enable the throwOnError it will also throw the errors that I have setup a toast for. Inside the error handlers I have set them up to throw the errors that arent put in a toast, but they dont get thrown when I have throwOnError disabled
1 Reply
passive-yellow
passive-yellow10mo ago
throwOnError can be a function so you can decide to throw or not on a per query / error basis

Did you find this page helpful?