0.1.1 • Published 11 years ago

domainit v0.1.1

Weekly downloads
6
License
-
Repository
github
Last release
11 years ago

domainit - wrap a function in the safety of a domain

Wrap a function with the warm comfort of a node domain using standard callbacks.

var assert = require('assert');
var domainit = require('domainit');

function unsafe(cb) {
  process.nextTick(function () {
    throw new Error('Oops!');
  });
}

var safe = domainit(unsafe);
safe(function (err) {
  assert(err);
  assert(err.message === 'Oops!');
});