From c79f502de546aa2133e3321bd84668c598f5afc3 Mon Sep 17 00:00:00 2001 From: =?utf8?q?J=C3=A9r=C3=B4me=20Benoit?= Date: Tue, 24 Sep 2024 19:19:42 +0200 Subject: [PATCH] build(ci): fix task function ops tests MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Signed-off-by: Jérôme Benoit --- src/worker/abstract-worker.ts | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/worker/abstract-worker.ts b/src/worker/abstract-worker.ts index 04515412..d49f37d8 100644 --- a/src/worker/abstract-worker.ts +++ b/src/worker/abstract-worker.ts @@ -264,11 +264,6 @@ export abstract class AbstractWorker< ): void { const { taskFunction, taskFunctionOperation, taskFunctionProperties } = message - if (typeof taskFunction !== 'string') { - throw new Error( - 'Cannot handle task function operation message without task function' - ) - } if (taskFunctionProperties == null) { throw new Error( 'Cannot handle task function operation message without task function properties' @@ -277,6 +272,11 @@ export abstract class AbstractWorker< let response: TaskFunctionOperationResult switch (taskFunctionOperation) { case 'add': + if (typeof taskFunction !== 'string') { + throw new Error( + `Cannot handle task function operation ${taskFunctionOperation} message without task function` + ) + } response = this.addTaskFunction(taskFunctionProperties.name, { // eslint-disable-next-line @typescript-eslint/no-implied-eval, no-new-func, @typescript-eslint/no-unsafe-call taskFunction: new Function( -- 2.34.1