Albert
Albert

Reputation: 94

Handle JavaScript errors

I'm working on a NodeJs project. I come across with a thought that how can I differentiate an error occur in operational process (for example: system is out of memory) from a programmer error (for example: syntax error)

Does anyone have a tip for this?

Thanks for any suggestion.

Upvotes: 0

Views: 61

Answers (1)

user6407432
user6407432

Reputation:

If you use something like process.on('uncaughtException', (err) => {throw err}) it will catch and throw any uncaught errors in your code.
Also, have a look at this for more information: https://www.joyent.com/node-js/production/design/errors

Upvotes: 1

Related Questions