Merge pull request #31 from embark-framework/fix-error-swallowing

fix: don't swallow uncaughtException
This commit is contained in:
Iuri Matias 2019-07-24 20:12:32 -04:00 committed by GitHub
commit 77d242f84f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 1 additions and 4 deletions

View File

@ -209,14 +209,11 @@ Screen.bind = function(screen) {
Screen._bound = true; Screen._bound = true;
process.on('uncaughtException', Screen._exceptionHandler = function(err) { process.on('uncaughtException', Screen._exceptionHandler = function(err) {
if (process.listeners('uncaughtException').length > 1) {
return;
}
Screen.instances.slice().forEach(function(screen) { Screen.instances.slice().forEach(function(screen) {
screen.destroy(); screen.destroy();
}); });
err = err || new Error('Uncaught Exception.'); err = err || new Error('Uncaught Exception.');
console.error(err.stack ? err.stack + '' : err + ''); process.stderr.write((err.stack || err) + "\n");
nextTick(function() { nextTick(function() {
process.exit(1); process.exit(1);
}); });