Skip to content

Commit

Permalink
lib: refactor to use validateFunction in diagnostics_channel
Browse files Browse the repository at this point in the history
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]>
  • Loading branch information
deokjinkim authored and targos committed Dec 4, 2023
1 parent bed1b93 commit 1cf087d
Showing 1 changed file with 1 addition and 3 deletions.
4 changes: 1 addition & 3 deletions lib/diagnostics_channel.js
Original file line number Diff line number Diff line change
Expand Up @@ -381,9 +381,7 @@ class TracingChannel {
}

const callback = ArrayPrototypeAt(args, position);
if (typeof callback !== 'function') {
throw new ERR_INVALID_ARG_TYPE('callback', ['function'], callback);
}
validateFunction(callback, 'callback');
ArrayPrototypeSplice(args, position, 1, wrappedCallback);

return start.runStores(context, () => {
Expand Down

0 comments on commit 1cf087d

Please sign in to comment.