Thursday 14 June 2018

Errors best practices

Hi everyone, what are the best practices for error handling in Node.js?I am building a web app and I am wondering:Should I just use the Native Error class, or should I extend that for every kind of error I want?In a web app I have a lot of different routes and all of them may raise an error. What is the best practice as far as where to deal with these errors? Do I answer a client as soon as I encounter an error, or is it better to next the error until an error middleware?By default the error class accepts just a string message. What about code, Http Status codes etc?Thanks

Submitted June 14, 2018 at 09:14AM by honestserpent

No comments:

Post a Comment