TanStackT
TanStack14mo ago
6 replies
awake-maroon

throw errors in createServerFn and catch it

hey, what is the correct way to throw errors in createServerFn()? im trying this -> make a call to my backend, which returns a 400 error with a json { "error": "msg" }. inside createServerFn i check res.ok, if not, throw an Error with backend message. but, when i create a mutation with react-query, and want to manage onError, error always is 500 and default error message
Was this page helpful?