Sunday, 10 November 2019

How do I handle errors properly?

So, right now my approach to handle errors in my projects is to simply call my own custom helper function, which basically sends back to the user json response with the status code and error message, and also log them with whole stack in the terminal. however, i think that i might be missing out on something. what is the proper way to handle errors?I am using async/await with try/catch, where in the catch block i use my helper function and pass in there some stuff about this error, so i wont be returning whole error to the user.

Submitted November 10, 2019 at 10:11AM by warchild4l

No comments:

Post a Comment