lib: refactor to use validateFunction in diagnostics_channel

Use validateFunction to remove duplicate implementation.

PR-URL: https://github.com/nodejs/node/pull/50955
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com>
Reviewed-By: Minwoo Jung <nodecorelab@gmail.com>
This commit is contained in:
Deokjin Kim
2023-11-30 22:55:06 +09:00
committed by GitHub
parent 431f32e302
commit e1bfd0a29e

View File

@@ -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, () => {