Skip to content

Commit 3ad9647

Browse files
committed
Print unhandled error before exit
It's no good when you do not see error caused process crash from it's output. Default behavior should be preserved.
1 parent 7787a12 commit 3ad9647

File tree

1 file changed

+8
-4
lines changed

1 file changed

+8
-4
lines changed

lib/exception.js

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,11 +17,15 @@ module.exports = {
1717
if (!self.excCaught) {
1818
self.excCaught = true;
1919
logger.methods.sendException(err, null, function () {
20-
if (exit === true) {
21-
process.exit(1);
22-
}
20+
process.stderr.write((err.stack || err) + '\n', exitProcess);
2321
});
2422
}
23+
24+
function exitProcess() {
25+
if (exit === true) {
26+
process.exit(1);
27+
}
28+
}
2529
});
2630
}());
2731
},
@@ -80,4 +84,4 @@ module.exports = {
8084
}());
8185
}
8286

83-
};
87+
};

0 commit comments

Comments
 (0)