Skip to content

Commit 9da6384

Browse files
deokjinkimrichardlau
authored andcommitted
lib: refactor to use validateFunction in diagnostics_channel
Use validateFunction to remove duplicate implementation. PR-URL: #50955 Reviewed-By: Luigi Pinca <[email protected]> Reviewed-By: Antoine du Hamel <[email protected]> Reviewed-By: Minwoo Jung <[email protected]>
1 parent 91cd918 commit 9da6384

File tree

1 file changed

+1
-3
lines changed

1 file changed

+1
-3
lines changed

lib/diagnostics_channel.js

+1-3
Original file line numberDiff line numberDiff line change
@@ -381,9 +381,7 @@ class TracingChannel {
381381
}
382382

383383
const callback = ArrayPrototypeAt(args, position);
384-
if (typeof callback !== 'function') {
385-
throw new ERR_INVALID_ARG_TYPE('callback', ['function'], callback);
386-
}
384+
validateFunction(callback, 'callback');
387385
ArrayPrototypeSplice(args, position, 1, wrappedCallback);
388386

389387
return start.runStores(context, () => {

0 commit comments

Comments
 (0)