Skip to content

Commit 5ba8940

Browse files
committedJan 13, 2017
catch unhandled promise rejections in build
1 parent 2cdc2b3 commit 5ba8940

File tree

2 files changed

+11
-0
lines changed

2 files changed

+11
-0
lines changed
 

‎build/gulpfile.hygiene.js

+5
Original file line numberDiff line numberDiff line change
@@ -229,6 +229,11 @@ gulp.task('hygiene', () => hygiene());
229229
if (require.main === module) {
230230
const cp = require('child_process');
231231

232+
process.on('unhandledRejection', (reason, p) => {
233+
console.log('Unhandled Rejection at: Promise', p, 'reason:', reason);
234+
process.exit(1);
235+
});
236+
232237
cp.exec('git config core.autocrlf', (err, out) => {
233238
const skipEOL = out.trim() === 'true';
234239

‎gulpfile.js

+6
Original file line numberDiff line numberDiff line change
@@ -58,8 +58,14 @@ var ALL_EDITOR_TASKS = [
5858
'tslint',
5959
'hygiene',
6060
];
61+
6162
var runningEditorTasks = process.argv.length > 2 && process.argv.slice(2).every(function (arg) { return (ALL_EDITOR_TASKS.indexOf(arg) !== -1); });
6263

64+
process.on('unhandledRejection', (reason, p) => {
65+
console.log('Unhandled Rejection at: Promise', p, 'reason:', reason);
66+
process.exit(1);
67+
});
68+
6369
if (runningEditorTasks) {
6470
require(`./build/gulpfile.editor`);
6571
require(`./build/gulpfile.hygiene`);

0 commit comments

Comments
 (0)
Please sign in to comment.