v3: disable Bluebird warning for missing return, fixes #7269

This commit is contained in:
Matteo Pagliazzi
2016-05-15 13:38:18 +02:00
parent 23a9a3e0e4
commit 6ec4d942df
2 changed files with 11 additions and 0 deletions

View File

@@ -10,6 +10,7 @@ if (process.env.NODE_ENV !== 'production') {
// The BabelJS polyfill is needed in production too // The BabelJS polyfill is needed in production too
require('babel-polyfill'); require('babel-polyfill');
// Setup Bluebird as the global promise library
global.Promise = require('bluebird'); global.Promise = require('bluebird');
// Only do the minimal amount of work before forking just in case of a dyno restart // Only do the minimal amount of work before forking just in case of a dyno restart

View File

@@ -2,6 +2,7 @@
import winston from 'winston'; import winston from 'winston';
import nconf from 'nconf'; import nconf from 'nconf';
import _ from 'lodash'; import _ from 'lodash';
import Bluebird from 'bluebird';
const IS_PROD = nconf.get('IS_PROD'); const IS_PROD = nconf.get('IS_PROD');
const IS_TEST = nconf.get('IS_TEST'); const IS_TEST = nconf.get('IS_TEST');
@@ -53,6 +54,15 @@ let loggerInterface = {
}, },
}; };
// Disable warnings for missed returns in Bluebird.
// See https://github.com/petkaantonov/bluebird/issues/903
Bluebird.config({
// Enables all warnings except forgotten return statements.
warnings: {
wForgottenReturn: false,
},
});
// Logs unhandled promises errors // Logs unhandled promises errors
// when no catch is attached to a promise a unhandledRejection event will be triggered // when no catch is attached to a promise a unhandledRejection event will be triggered
process.on('unhandledRejection', function handlePromiseRejection (reason) { process.on('unhandledRejection', function handlePromiseRejection (reason) {