From 4a537a1a729bd3c5fb7eaccb0a6cafa4f660f26b Mon Sep 17 00:00:00 2001 From: =?utf8?q?J=C3=A9r=C3=B4me=20Benoit?= Date: Fri, 7 Jun 2024 19:09:47 +0200 Subject: [PATCH] refactor: cleanup task function(s) handling code 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 ec77ccab..ebbefc75 100644 --- a/src/worker/abstract-worker.ts +++ b/src/worker/abstract-worker.ts @@ -78,7 +78,6 @@ export abstract class AbstractWorker< /** * Handler id of the `activeInterval` worker activity check. */ - // eslint-disable-next-line no-undef protected activeInterval?: NodeJS.Timeout /** @@ -378,15 +377,16 @@ export abstract class AbstractWorker< response = { status: false, error: new Error('Unknown task operation') } break } + const { status, error } = response this.sendToMainWorker({ taskFunctionOperation, - taskFunctionOperationStatus: response.status, + taskFunctionOperationStatus: status, taskFunctionProperties, - ...(!response.status && - response.error != null && { + ...(!status && + error != null && { workerError: { name: taskFunctionProperties.name, - message: this.handleError(response.error as Error | string), + message: this.handleError(error as Error | string), }, }), }) -- 2.34.1