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 Oct 15, 2020
1 parent 2bee93e commit c947273
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 @@ -307,6 +307,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 c947273

Please sign in to comment.