GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — perf_hooks: fix error message for invalid entryTypes · nodejs/node@398bdf4

File tree

Expand file treeCollapse file tree
Open diff view settings
Filter options
  • lib
    • perf_hooks.js
  • test/parallel
    • test-performanceobserver.js
Expand file treeCollapse file tree
Open diff view settings
Collapse file

‎lib/perf_hooks.js‎

Copy file name to clipboardExpand all lines: lib/perf_hooks.js
+6-5Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -341,19 +341,20 @@ class PerformanceObserver extends AsyncResource {
341341
if (typeof options !== 'object' || options === null) {
342342
throw new ERR_INVALID_ARG_TYPE('options', 'Object', options);
343343
}
344-
if (!ArrayIsArray(options.entryTypes)) {
345-
throw new ERR_INVALID_OPT_VALUE('entryTypes', options);
344+
const { entryTypes } = options;
345+
if (!ArrayIsArray(entryTypes)) {
346+
throw new ERR_INVALID_OPT_VALUE('entryTypes', entryTypes);
346347
}
347-
const entryTypes = options.entryTypes.filter(filterTypes).map(mapTypes);
348-
if (entryTypes.length === 0) {
348+
const filteredEntryTypes = entryTypes.filter(filterTypes).map(mapTypes);
349+
if (filteredEntryTypes.length === 0) {
349350
throw new ERR_VALID_PERFORMANCE_ENTRY_TYPE();
350351
}
351352
this.disconnect();
352353
const observerCountsGC = observerCounts[NODE_PERFORMANCE_ENTRY_TYPE_GC];
353354
this[kBuffer][kEntries] = [];
354355
L.init(this[kBuffer][kEntries]);
355356
this[kBuffering] = Boolean(options.buffered);
356-
for (const entryType of entryTypes) {
357+
for (const entryType of filteredEntryTypes) {
357358
const list = getObserversList(entryType);
358359
if (this[kTypes][entryType]) continue;
359360
const item = { obs: this };
Collapse file

‎test/parallel/test-performanceobserver.js‎

Copy file name to clipboardExpand all lines: test/parallel/test-performanceobserver.js
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ assert.strictEqual(counts[NODE_PERFORMANCE_ENTRY_TYPE_FUNCTION], 0);
5858
{
5959
code: 'ERR_INVALID_OPT_VALUE',
6060
name: 'TypeError',
61-
message: 'The value "[object Object]" is invalid ' +
61+
message: `The value "${i}" is invalid ` +
6262
'for option "entryTypes"'
6363
});
6464
});

0 commit comments

Comments
0 (0)
You are visitor 01402503 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.