poolMaxSize: WorkerConstants.DEFAULT_POOL_MAX_SIZE,
elementsPerWorker: WorkerConstants.DEFAULT_ELEMENTS_PER_WORKER,
poolOptions: {},
- messageHandler: () => {
- /* This is intentional */
- },
+ messageHandler: WorkerConstants.EMPTY_FUNCTION,
}
) {
- if (!workerScript) {
+ if (workerScript === null || workerScript === undefined) {
throw new Error('Worker script is not defined');
}
+ if (typeof workerScript === 'string' && workerScript.trim().length === 0) {
+ throw new Error('Worker script is empty');
+ }
if (!fs.existsSync(workerScript)) {
throw new Error('Worker script file does not exist');
}