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 <luigipinca@gmail.com>
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com>
Reviewed-By: Minwoo Jung <nodecorelab@gmail.com>
  • Loading branch information
deokjinkim authored and richardlau committed Mar 25, 2024
1 parent 91cd918 commit 9da6384
Showing 1 changed file with 1 addition and 3 deletions.
4 changes: 1 addition & 3 deletions lib/diagnostics_channel.js
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 9da6384

Please sign in to comment.