summaryrefslogtreecommitdiff
path: root/lib/assert.js
diff options
context:
space:
mode:
authorRuben Bridgewater <ruben@bridgewater.de>2019-03-18 03:47:55 +0100
committerRuben Bridgewater <ruben@bridgewater.de>2019-03-23 02:55:55 +0100
commit3fe1e80896d69b2125e3a264d0707fdbc6f37740 (patch)
tree8e909c53a2cdf52650504f21467e9961d2aec6ef /lib/assert.js
parentbfbce289c33b12aafb82bd5b45bcb4412850b28f (diff)
downloadandroid-node-v8-3fe1e80896d69b2125e3a264d0707fdbc6f37740.tar.gz
android-node-v8-3fe1e80896d69b2125e3a264d0707fdbc6f37740.tar.bz2
android-node-v8-3fe1e80896d69b2125e3a264d0707fdbc6f37740.zip
lib: validate Error.captureStackTrace() calls
This adds a custom eslint rule to verify that `Error.captureStackTrace()` is only called if necessary. In most cases the helper function should be used instead. PR-URL: https://github.com/nodejs/node/pull/26738 Reviewed-By: Gus Caplan <me@gus.host> Reviewed-By: Matteo Collina <matteo.collina@gmail.com> Reviewed-By: Michaƫl Zasso <targos@protonmail.com> Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com>
Diffstat (limited to 'lib/assert.js')
-rw-r--r--lib/assert.js1
1 files changed, 1 insertions, 0 deletions
diff --git a/lib/assert.js b/lib/assert.js
index 99c000e316..51ee781b59 100644
--- a/lib/assert.js
+++ b/lib/assert.js
@@ -240,6 +240,7 @@ function getErrMessage(message, fn) {
// We only need the stack trace. To minimize the overhead use an object
// instead of an error.
const err = {};
+ // eslint-disable-next-line no-restricted-syntax
Error.captureStackTrace(err, fn);
Error.stackTraceLimit = tmpLimit;