X-Git-Url: https://git.piment-noir.org/?a=blobdiff_plain;f=src%2Fworker%2FWorkerAbstract.ts;h=16d566bde2ae60049fe401c7f13f830af4ce17dd;hb=66dd344779f5258bbf4c76b386d005c0c2160b11;hp=2803eea464da27115e45e1a6a3546fdee46418a9;hpb=59b6ed8d1db313ef3371efd8ab5e039cf3dedab0;p=e-mobility-charging-stations-simulator.git diff --git a/src/worker/WorkerAbstract.ts b/src/worker/WorkerAbstract.ts index 2803eea4..16d566bd 100644 --- a/src/worker/WorkerAbstract.ts +++ b/src/worker/WorkerAbstract.ts @@ -23,13 +23,16 @@ export abstract class WorkerAbstract { poolMinSize: WorkerConstants.DEFAULT_POOL_MIN_SIZE, poolMaxSize: WorkerConstants.DEFAULT_POOL_MAX_SIZE, elementsPerWorker: WorkerConstants.DEFAULT_ELEMENTS_PER_WORKER, - poolOptions: WorkerConstants.EMPTY_OBJECT, + poolOptions: {}, 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'); }