diff options
author | Antoine du Hamel <duhamelantoine1995@gmail.com> | 2020-10-27 20:41:34 +0100 |
---|---|---|
committer | Node.js GitHub Bot <github-bot@iojs.org> | 2020-10-30 11:08:20 +0000 |
commit | 1da672994ac26658375db2b6a60fb00e56d02a4d (patch) | |
tree | c6976f2c55f20f07a179aeb3e98e098aadfea6c8 /lib/events.js | |
parent | 05bb1b3f9460f96a0241ecd2fada6d3abfdaf61d (diff) | |
download | node-new-1da672994ac26658375db2b6a60fb00e56d02a4d.tar.gz |
lib: use primordials when calling methods of Error
This is to unsure that code using those methods won't crash if the
methods are deleted in userland.
PR-URL: https://github.com/nodejs/node/pull/35837
Reviewed-By: Michaƫl Zasso <targos@protonmail.com>
Reviewed-By: Rich Trott <rtrott@gmail.com>
Reviewed-By: Shingo Inoue <leko.noor@gmail.com>
Diffstat (limited to 'lib/events.js')
-rw-r--r-- | lib/events.js | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/lib/events.js b/lib/events.js index 7d3ee54018..f82776072b 100644 --- a/lib/events.js +++ b/lib/events.js @@ -24,6 +24,7 @@ const { Boolean, Error, + ErrorCaptureStackTrace, MathMin, NumberIsNaN, ObjectCreate, @@ -291,8 +292,7 @@ EventEmitter.prototype.emit = function emit(type, ...args) { if (er instanceof Error) { try { const capture = {}; - // eslint-disable-next-line no-restricted-syntax - Error.captureStackTrace(capture, EventEmitter.prototype.emit); + ErrorCaptureStackTrace(capture, EventEmitter.prototype.emit); ObjectDefineProperty(er, kEnhanceStackBeforeInspector, { value: enhanceStackTrace.bind(this, er, capture), configurable: true |