X-Git-Url: https://git.piment-noir.org/?a=blobdiff_plain;f=src%2Fworker%2FWorkerAbstract.ts;h=16d566bde2ae60049fe401c7f13f830af4ce17dd;hb=ba516f9cbce4070d1b5eda82a2cd48b82a67c500;hp=3dd9a782a8661507f61fa21787ed9f80c9465852;hpb=5a983ff4d2a73c89f8894f0c17e9ae78cfe026a3;p=e-mobility-charging-stations-simulator.git diff --git a/src/worker/WorkerAbstract.ts b/src/worker/WorkerAbstract.ts index 3dd9a782..16d566bd 100644 --- a/src/worker/WorkerAbstract.ts +++ b/src/worker/WorkerAbstract.ts @@ -27,9 +27,12 @@ export abstract class WorkerAbstract { 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'); }