Skip to content

Commit 075bb9d

Browse files
committed
Ignore the DEP0097 runtime deprecation in the Javascript CloudI API due to required domain module use (prevents stderr output logged as ERROR that is not an error).
1 parent 6f6b14d commit 075bb9d

File tree

1 file changed

+22
-0
lines changed

1 file changed

+22
-0
lines changed

CloudI.js

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,28 @@ var nodejsVersionAfter = function nodejsVersionAfter (s) {
8282
}
8383
return false;
8484
};
85+
if (nodejsVersionAfter('10.0.0')) {
86+
var originalEmitWarning = process.emitWarning;
87+
process.emitWarning = function(warning, type, code, ctor) {
88+
if (code === 'DEP0097') {
89+
// Ignore the stderr output of the runtime deprecation:
90+
// "Using a domain property in MakeCallback is deprecated.
91+
// Use the async_context variant of MakeCallback or the
92+
// AsyncResource class instead."
93+
//
94+
// Until the exception handling of the domain module is
95+
// provided by a different module (like async_hooks) or
96+
// exceptions (throw/try/catch) are removed from Javascript,
97+
// the use of the domain module needs to remain
98+
// (to remain consistent with other CloudI API implementations).
99+
// The stderr runtime deprecation information is ignored
100+
// because it provides no useful information and is only an
101+
// annoyance as a false negative.
102+
return;
103+
}
104+
originalEmitWarning(warning, type, code, ctor);
105+
};
106+
}
85107

86108
var InvalidInputException = function InvalidInputException () {
87109
var error = new Error('Invalid Input');

0 commit comments

Comments
 (0)