Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 0defe4e

Browse filesBrowse files
deokjinkimjuanarbol
authored andcommitted
trace_events: refactor to use validateStringArray
`options.categories` is string[]. So used `validateStringArray` Refs: https://nodejs.org/dist/latest-v19.x/docs/api/tracing.html#trace_eventscreatetracingoptions PR-URL: #46012 Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
1 parent 297773c commit 0defe4e
Copy full SHA for 0defe4e

File tree

Expand file treeCollapse file tree

1 file changed

+2
-7
lines changed
Open diff view settings
Filter options
Expand file treeCollapse file tree

1 file changed

+2
-7
lines changed
Open diff view settings
Collapse file

‎lib/trace_events.js‎

Copy file name to clipboardExpand all lines: lib/trace_events.js
+2-7Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
'use strict';
22

33
const {
4-
ArrayIsArray,
54
ArrayPrototypeJoin,
65
SafeSet,
76
Symbol,
@@ -17,7 +16,6 @@ const kMaxTracingCount = 10;
1716
const {
1817
ERR_TRACE_EVENTS_CATEGORY_REQUIRED,
1918
ERR_TRACE_EVENTS_UNAVAILABLE,
20-
ERR_INVALID_ARG_TYPE
2119
} = require('internal/errors').codes;
2220

2321
const { ownsProcessState } = require('internal/worker');
@@ -29,6 +27,7 @@ const { customInspectSymbol } = require('internal/util');
2927
const { format } = require('internal/util/inspect');
3028
const {
3129
validateObject,
30+
validateStringArray,
3231
} = require('internal/validators');
3332

3433
const enabledTracingObjects = new SafeSet();
@@ -84,11 +83,7 @@ class Tracing {
8483

8584
function createTracing(options) {
8685
validateObject(options, 'options');
87-
88-
if (!ArrayIsArray(options.categories)) {
89-
throw new ERR_INVALID_ARG_TYPE('options.categories', 'string[]',
90-
options.categories);
91-
}
86+
validateStringArray(options.categories, 'options.categories');
9287

9388
if (options.categories.length <= 0)
9489
throw new ERR_TRACE_EVENTS_CATEGORY_REQUIRED();

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.