T
TanStack•11mo ago
absent-sapphire

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
3 Replies
absent-sapphire
absent-sapphireOP•11mo ago
😭😭
fair-rose
fair-rose•11mo ago
please create a new github issue including a complete minimal example
absent-sapphire
absent-sapphireOP•11mo ago
Okay I would do that

Did you find this page helpful?