TanStackT
TanStack8mo ago
7 replies
full-green

How to trycatch the entire defaultAPIFileRouteHandler and return a 500 status code ?

I want to return a 500 status code when any of the /api/ routes throw an error. Currently by default setup from the docs shows this with the stack trace.
how do i manage to try catch all the /api/ routes and return a 500 with like the following json { message: "internal server errror" }
i also would like to have the exception console.log()-ed
how do i manage to do this ?
image.png
Was this page helpful?