Skip to content

Commit 01209d5

Browse files
committed
Merge pull request #10 from estliberitas/print-unhandled
Print unhandled error before exit
2 parents 7787a12 + 3ad9647 commit 01209d5

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)