diff options
author | Ruben Bridgewater <ruben@bridgewater.de> | 2019-03-18 02:29:39 +0100 |
---|---|---|
committer | Ruben Bridgewater <ruben@bridgewater.de> | 2019-03-23 02:55:54 +0100 |
commit | bfbce289c33b12aafb82bd5b45bcb4412850b28f (patch) | |
tree | fa9c21007fbe096b11e5a10d80de4b0af91137e4 /lib/assert.js | |
parent | 1ed3c54ecbd72a33693e5954f86bcc9fd9b1cc09 (diff) | |
download | android-node-v8-bfbce289c33b12aafb82bd5b45bcb4412850b28f.tar.gz android-node-v8-bfbce289c33b12aafb82bd5b45bcb4412850b28f.tar.bz2 android-node-v8-bfbce289c33b12aafb82bd5b45bcb4412850b28f.zip |
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>
Diffstat (limited to 'lib/assert.js')
0 files changed, 0 insertions, 0 deletions