middleware/mw.error.handling.js
function handleGlobalError() {

        // make sure Q provides long stack traces (disabled in prod for performance)
        Q.longStackSupport = config.longStackSupport;

        // hopefully we handle errors before this point, but this will log anything not caught
        process.on('uncaughtException', function (err) {
            log.critical('global uncaught exception : ' + err + '\n' + err.stack);

            /* eslint no-process-exit: 0 */
            process.exit(1);
        });
    }
function handleGlobalError() {

        // make sure Q provides long stack traces (disabled in prod for performance)
        Q.longStackSupport = config.longStackSupport;

        // hopefully we handle errors before this point, but this will log anything not caught
        process.on('uncaughtException', function (err) {
            log.critical('global uncaught exception : ' + err + '\n' + err.stack);

            /* eslint no-process-exit: 0 */
            process.exit(1);
        });
    }
function handleGlobalError ( ) { // make sure Q provides long stack traces (disabled in prod for performance) Q . longStackSupport = config . longStackSupport ; // hopefully we handle errors before this point, but this will log anything not caught process . on ( 'uncaughtException' , function ( err ) { log . critical ( 'global uncaught exception : ' + err + '\n' + err . stack ) ; /* eslint no-process-exit: 0 */ process . exit ( 1 ) ; } ) ; }
Configure global error handling which includes Q and catching uncaught exceptions
Configure global error handling which includes Q and catching uncaught exceptions