diff --git a/index.js b/index.js index 69e89ed13e..c026b45293 100644 --- a/index.js +++ b/index.js @@ -1,3 +1,10 @@ 'use strict'; // eslint-disable-line strict +/** + * Catch uncaught exceptions and add timestamp to aid debugging + */ +process.on('uncaughtException', err => { + process.stderr.write(`${new Date().toISOString()}: Uncaught exception: \n${err.stack}`); +}); + require('./lib/server.js')();