domain: dry decorate using util._extend

This commit is contained in:
Andreas Madsen 2012-06-08 19:59:35 +02:00 committed by Ben Noordhuis
parent 26f754d9dd
commit 77cfbd9f2d

View File

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