Curious if there is a standard best practice for laying out error handling on a simple rest api. How do you handle the error message on the frontend (does that come from the error response?). What is the general structure of using zod to check body shape and then all other error handling (nested try catches?) do u use safeParse on zod?
I am trying to really clean up my code with full error handling and want to know what the best option is for it. Always been a minor point of confusion for me somehow.
(Should I basically wrap the entire endpoint in a try catch and then nest more inside of it for specific errors? Should error messages come from the response or should it be a code and the frontend chooses the message, or something else??)