Browse Source

domain: dry decorate using util._extend

v0.9.1-release
Andreas Madsen 13 years ago
committed by Ben Noordhuis
parent
commit
77cfbd9f2d
  1. 12
      lib/domain.js

12
lib/domain.js

@ -53,7 +53,7 @@ function uncaughtHandler(er) {
// if there's an active domain, then handle this there.
// Note that if this error emission throws, then it'll just crash.
if (exports.active && !exports.active._disposed) {
decorate(er, {
util._extend(er, {
domain: exports.active,
domain_thrown: true
});
@ -158,7 +158,7 @@ Domain.prototype.bind = function(cb, interceptError) {
if (interceptError && arguments[0] &&
(arguments[0] instanceof Error)) {
var er = arguments[0];
decorate(er, {
util._extend(er, {
domain_bound: cb,
domain_thrown: false,
domain: self
@ -251,11 +251,3 @@ Domain.prototype.dispose = function() {
// so that it can't be entered or activated.
this._disposed = true;
};
function decorate(er, props) {
Object.keys(props).forEach(function(k, _, __) {
if (er.hasOwnProperty(k)) return;
er[k] = props[k];
});
}

Loading…
Cancel
Save