1
爲什麼domain不處理以下錯誤?爲什麼域名無法捕捉到異常?
var globalDomain = domain.createDomain();
globalDomain.run(function() {
// Why below exception does not get handled by globalDomain?
throw "some error";
});
globalDomain.on('error', function(msg) {
console.log("In global error event:" + msg);
});
再次,它工作得很好用下面的代碼,
var globalDomain = domain.createDomain();
globalDomain.run(function() {
setTimeout(function(){
throw "some error from timeout";
},0);
});
globalDomain.on('error', function(msg) {
console.log("In global error event:" + msg);
});