Skip to content

Commit

Permalink
errors: fix the comments for hideStackFrame
Browse files Browse the repository at this point in the history
Fix the comments for the no-overhead hideStackFrame

Refs: nodejs#35644
  • Loading branch information
mmomtchev committed Nov 24, 2020
1 parent abf684c commit 865e2eb
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 4 deletions.
4 changes: 0 additions & 4 deletions benchmark/misc/hidestackframes.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,6 @@

const common = require('../common.js');

/* there should be no significant performance differences
* between the hideStackFrames version and the direct
* call version
*/
const bench = common.createBenchmark(main, {
type: ['hide-stackframes-throw', 'direct-call-throw',
'hide-stackframes-noerr', 'direct-call-noerr'],
Expand Down
2 changes: 2 additions & 0 deletions lib/internal/errors.js
Original file line number Diff line number Diff line change
Expand Up @@ -326,6 +326,8 @@ function makeNodeErrorWithCode(Base, key) {

// This function removes unnecessary frames from Node.js core errors.
function hideStackFrames(fn) {
// We rename the functions that will be hidden to cut off the stacktrace
// at the outermost one
const hidden = '__node_internal_hidden_' + fn.name;
ObjectDefineProperty(fn, 'name', { value: hidden });
return fn;
Expand Down

0 comments on commit 865e2eb

Please sign in to comment.