build(deps): apply updates
[e-mobility-charging-stations-simulator.git] / src / worker / WorkerAbstract.ts
index 912f5256575bb2ca9a5b486bb8ed0cce8cd5bd9e..cd4dedf992fca40ff0b7cb787e91468d28020d55 100644 (file)
@@ -21,11 +21,14 @@ export abstract class WorkerAbstract<T extends WorkerData> {
    * @param workerOptions -
    */
   constructor(workerScript: string, workerOptions: WorkerOptions) {
-    if (workerScript === null || workerScript === undefined) {
-      throw new Error('Worker script is not defined');
+    if (workerScript == null) {
+      throw new TypeError('Worker script is not defined');
     }
-    if (typeof workerScript === 'string' && workerScript.trim().length === 0) {
-      throw new Error('Worker script is empty');
+    if (typeof workerScript !== 'string') {
+      throw new TypeError('Worker script must be a string');
+    }
+    if (workerScript.trim().length === 0) {
+      throw new Error('Worker script is an empty string');
     }
     if (!existsSync(workerScript)) {
       throw new Error('Worker script file does not exist');