node/lib/internal/util
Ruben Bridgewater bfbce289c3
lib: refactor Error.captureStackTrace() usage
When using `Errors.captureStackFrames` the error's stack property
is set again. This adds a helper function that wraps this functionality
in a simple API that does not only set the stack including the `code`
property but it also improves the performance to create the error.
The helper works for thrown errors and errors returned from wrapped
functions in case they are Node.js core errors.

PR-URL: https://github.com/nodejs/node/pull/26738
Fixes: https://github.com/nodejs/node/issues/26669
Fixes: https://github.com/nodejs/node/issues/20253
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>
2019-03-23 02:55:54 +01:00
..
comparisons.js util: extract uncurryThis function for reuse 2019-03-21 23:07:48 +01:00
debuglog.js lib: explicitly initialize debuglog during bootstrap 2019-03-08 13:57:38 +01:00
inspect.js lib: refactor Error.captureStackTrace() usage 2019-03-23 02:55:54 +01:00
inspector.js src: simplify InspectorConsoleCall 2019-02-20 16:54:39 +01:00
types.js util: extract uncurryThis function for reuse 2019-03-21 23:07:48 +01:00