From 18d23af01a3f3e61695ca6cc98c128046723da66 Mon Sep 17 00:00:00 2001 From: azivner Date: Thu, 26 Oct 2017 19:16:36 -0400 Subject: [PATCH] fix the unhandled rejection logging to lock stack trace --- bin/www | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/bin/www b/bin/www index eecb3924f..55cec0b7a 100755 --- a/bin/www +++ b/bin/www @@ -1,12 +1,12 @@ #!/usr/bin/env node -process.on('unhandledRejection', (reason, p) => { - const message = 'Unhandled Rejection at: Promise' + p + ', reason:' + reason; +process.on('unhandledRejection', error => { // this makes sure that stacktrace of failed promise is printed out - console.log(message); + console.log(error); // but also try to log it into file - require('../services/log').error(message); + // we're using .info() instead of .error() because simple-node-logger emits weird error for error() + require('../services/log').info(error); }); const app = require('../app');