diff --git a/lib/trace_events.js b/lib/trace_events.js index 5211f8b0b1f..672095cec41 100644 --- a/lib/trace_events.js +++ b/lib/trace_events.js @@ -1,7 +1,6 @@ 'use strict'; const { - ArrayIsArray, ArrayPrototypeJoin, SafeSet, Symbol, @@ -17,7 +16,6 @@ const kMaxTracingCount = 10; const { ERR_TRACE_EVENTS_CATEGORY_REQUIRED, ERR_TRACE_EVENTS_UNAVAILABLE, - ERR_INVALID_ARG_TYPE } = require('internal/errors').codes; const { ownsProcessState } = require('internal/worker'); @@ -29,6 +27,7 @@ const { customInspectSymbol } = require('internal/util'); const { format } = require('internal/util/inspect'); const { validateObject, + validateStringArray, } = require('internal/validators'); const enabledTracingObjects = new SafeSet(); @@ -84,11 +83,7 @@ class Tracing { function createTracing(options) { validateObject(options, 'options'); - - if (!ArrayIsArray(options.categories)) { - throw new ERR_INVALID_ARG_TYPE('options.categories', 'string[]', - options.categories); - } + validateStringArray(options.categories, 'options.categories'); if (options.categories.length <= 0) throw new ERR_TRACE_EVENTS_CATEGORY_REQUIRED();