summaryrefslogtreecommitdiff
path: root/lib/domain.js
diff options
context:
space:
mode:
Diffstat (limited to 'lib/domain.js')
-rw-r--r--lib/domain.js16
1 files changed, 16 insertions, 0 deletions
diff --git a/lib/domain.js b/lib/domain.js
index 08fbd207f1..be109c9ce0 100644
--- a/lib/domain.js
+++ b/lib/domain.js
@@ -94,13 +94,29 @@ process.setUncaughtExceptionCaptureCallback = function(fn) {
throw err;
};
+
+let sendMakeCallbackDeprecation = false;
+function emitMakeCallbackDeprecation() {
+ if (!sendMakeCallbackDeprecation) {
+ process.emitWarning(
+ 'Using a domain property in MakeCallback is deprecated. Use the ' +
+ 'async_context variant of MakeCallback or the AsyncResource class ' +
+ 'instead.', 'DeprecationWarning', 'DEP0097');
+ sendMakeCallbackDeprecation = true;
+ }
+}
+
function topLevelDomainCallback(cb, ...args) {
const domain = this.domain;
+ if (exports.active && domain)
+ emitMakeCallbackDeprecation();
+
if (domain)
domain.enter();
const ret = Reflect.apply(cb, this, args);
if (domain)
domain.exit();
+
return ret;
}