TanStackT
TanStack16mo ago
3 replies
spontaneous-moccasin

Returning errors with status codes in server fn

If my server function return a status code of 400 or other indicating error the mutation automatically rejects and goes to the onError callback

The actual error object returned is accessible on error.message but it has been stringified so I have to parse it to get the actual object I returned back but I lose every bit of typesafety and this seems like something could go wrong if I maybe return a string or something some other time
Was this page helpful?