refactor: syntax check in worker configuration section
authorJérôme Benoit <jerome.benoit@sap.com>
Sun, 16 Jul 2023 19:40:17 +0000 (21:40 +0200)
committerJérôme Benoit <jerome.benoit@sap.com>
Sun, 16 Jul 2023 19:40:17 +0000 (21:40 +0200)
Signed-off-by: Jérôme Benoit <jerome.benoit@sap.com>
src/utils/Configuration.ts

index b88d340443ac59c863497a8a15fc1af5288d3e3a..d4b4c997dbe0d0f717217d1e141d610e39281eb1 100644 (file)
@@ -327,6 +327,11 @@ export class Configuration {
       ...deprecatedWorkerConfiguration,
       ...(hasOwnProp(Configuration.getConfig(), 'worker') && Configuration.getConfig()?.worker),
     };
+    if (!Object.values(WorkerProcessType).includes(workerConfiguration.processType!)) {
+      throw new SyntaxError(
+        `Invalid worker process type '${workerConfiguration.processType}' defined in configuration`,
+      );
+    }
     return workerConfiguration;
   }