DEV Community

Discussion on: JavaScript/Node Best Practices

Collapse
 
nirajkvinit profile image
Niraj Kumar

Thanks Harris! I believe - the following article sums it well:

It is a wrong practise to handle errors within Express middleware — doing so will not cover errors that are thrown in non-web interfaces.

Without one dedicated object for error handling, greater are the chances of important errors hiding under the radar due to improper handling. The error handler object is responsible for making the error visible, for example by writing to a well-formatted logger, sending events to some monitoring product like Sentry, Rollbar, or Raygun

medium.com/devcbeirut/error-handli...