domain: dry decorate using util._extend
This commit is contained in:
parent
26f754d9dd
commit
77cfbd9f2d
@ -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…
x
Reference in New Issue
Block a user