From 77cfbd9f2d286368627a8dfa4f4f5cbdfd6f89e1 Mon Sep 17 00:00:00 2001 From: Andreas Madsen Date: Fri, 8 Jun 2012 19:59:35 +0200 Subject: [PATCH] domain: dry decorate using util._extend --- lib/domain.js | 12 ++---------- 1 file changed, 2 insertions(+), 10 deletions(-) diff --git a/lib/domain.js b/lib/domain.js index 12ab409c341..d1c89596270 100644 --- a/lib/domain.js +++ b/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]; - }); -}