mirror of
https://github.com/nodejs/node.git
synced 2026-10-14 10:26:26 -04:00
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>
This commit is contained in:
9 files changed
+15
No files matched your search
@@ -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;
|
||||
|
||||
Reference in new issue
Block a user