From 4b1bf5e52941b72cf619a246f87b261da95a1231 Mon Sep 17 00:00:00 2001 From: Yunong Xiao Date: Wed, 29 Jan 2014 11:27:14 -0800 Subject: [PATCH] #244 catch async exceptions and log their stacks --- lib/track.js | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/lib/track.js b/lib/track.js index 5af98adfd..19e3618d0 100644 --- a/lib/track.js +++ b/lib/track.js @@ -27,6 +27,11 @@ exports.createTracker = function (on_exit) { } }; + process.on('uncaughtException', function (err) { + console.error(err.stack); + process.exit(1); + }); + process.on('exit', function() { on_exit = on_exit || exports.default_on_exit; on_exit(tracker);