Skip to content

Instantly share code, notes, and snippets.

@forced-request
Created February 22, 2019 21:06
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save forced-request/fc8a0f6796eda21bc72a428d8201263e to your computer and use it in GitHub Desktop.
Save forced-request/fc8a0f6796eda21bc72a428d8201263e to your computer and use it in GitHub Desktop.
Handle all uncaught exceptions to prevent node service from crashing. This is useful for preventing denial-of-service attacks in Node.JS
/* Tell Node not to crash */
process.on('uncaughtException', function (err) {
console.log('Caught exception: ', err);
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment