Sometimes there is logic in your code that might error out without having full control over them.Think about making request to APIs, hashing a password, etc.Right now I wrap almost every route on my server in a try-catch block and create relevant error handlers within the try part like: if (X) return res.status(X).send(X).However, I can't figure out if this is good practice or not. To me it seems like a sort of safety net where you can be assured that if something errors out, the server will at least send a response. I would like to hear your thoughts.
Submitted August 27, 2020 at 03:16PM by CryptoScience
No comments:
Post a Comment