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>
This commit is contained in:
Antoine du Hamel authored and Node.js GitHub Bot committed 2020-10-30 11:08:20 +00:00
1 parent 05bb1b3f94
commit 1da672994a
8 files changed
+23 -37

No files matched your search

+2 -2
View File
@@ -2,6 +2,7 @@
const {
Error,
ErrorCaptureStackTrace,
MathMax,
ObjectCreate,
ObjectDefineProperty,
@@ -444,8 +445,7 @@ class AssertionError extends Error {
this.expected = expected;
this.operator = operator;
}
// eslint-disable-next-line no-restricted-syntax
Error.captureStackTrace(this, stackStartFn || stackStartFunction);
ErrorCaptureStackTrace(this, stackStartFn || stackStartFunction);
// Create error message including the error code in the name.
this.stack;
// Reset the name.