From: Jérôme Benoit Date: Fri, 7 Jun 2024 17:09:47 +0000 (+0200) Subject: refactor: cleanup task function(s) handling code X-Git-Tag: v4.0.14~9 X-Git-Url: https://git.piment-noir.org/?a=commitdiff_plain;h=4a537a1a729bd3c5fb7eaccb0a6cafa4f660f26b;hp=fc10700f705f3246c76224265893635f9b28e4f0;p=poolifier.git refactor: cleanup task function(s) handling code Signed-off-by: Jérôme Benoit --- 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), }, }), })