Learning Blog

預定調和

使用 Domains 處理 node.js 的 Expectation

| Comments

寫 node.js 久了之後程式會慢慢變大因此有時會出現 uncaughtException 的問題,由於 node.js 異步的特性所以會無法抓取到錯誤並處理它, 所以在 node.js 0.8 之後出現了 domains 的模組讓開發者使用。

var domain = require('domain');
var d = domain.create();
var serverDomain = domain.create();
serverDomain.run(function() {


});

Comments