1

ドメインが以下のエラーを処理しないのはなぜですか?

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);
});
4

1 に答える 1

3
var globalDomain = domain.createDomain();

globalDomain.on('error', function(msg) {
    console.log("In global error event:" + msg);
});

globalDomain.run( function() {
    //  exception gets handled by globalDomain !!
    throw "some error"; 
});
于 2013-02-07T11:42:59.900 に答える