diff options
author | Ruben Bridgewater <ruben@bridgewater.de> | 2019-03-18 05:47:55 +0300 |
---|---|---|
committer | Ruben Bridgewater <ruben@bridgewater.de> | 2019-03-23 04:55:55 +0300 |
commit | 3fe1e80896d69b2125e3a264d0707fdbc6f37740 (patch) | |
tree | 8e909c53a2cdf52650504f21467e9961d2aec6ef /lib/internal/assert | |
parent | bfbce289c33b12aafb82bd5b45bcb4412850b28f (diff) |
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/internal/assert')
-rw-r--r-- | lib/internal/assert/assertion_error.js | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/lib/internal/assert/assertion_error.js b/lib/internal/assert/assertion_error.js index ded5ef00c93..c8edf13eca8 100644 --- a/lib/internal/assert/assertion_error.js +++ b/lib/internal/assert/assertion_error.js @@ -398,6 +398,7 @@ class AssertionError extends Error { this.actual = actual; this.expected = expected; this.operator = operator; + // eslint-disable-next-line no-restricted-syntax Error.captureStackTrace(this, stackStartFn); // Create error message including the error code in the name. this.stack; |