X-Git-Url: https://git.piment-noir.org/?a=blobdiff_plain;f=src%2Fworker%2Fabstract-worker.ts;h=6c6de861156e040285fc3a4ad4c50ba5e796f04f;hb=adee605399485348ae224e7e4c022f024373b0ef;hp=bd03d86e06eefee9871215a49aeb11343236be0d;hpb=04714ef7597328d4ca3111dafb0a8fdf01b24e98;p=poolifier.git diff --git a/src/worker/abstract-worker.ts b/src/worker/abstract-worker.ts index bd03d86e..6c6de861 100644 --- a/src/worker/abstract-worker.ts +++ b/src/worker/abstract-worker.ts @@ -386,7 +386,7 @@ export abstract class AbstractWorker< new Function(`return ${taskFunction as string}`)() as TaskFunction< Data, Response - > /* NOSONAR */ + > ) } else if (taskFunctionOperation === 'remove') { response = this.removeTaskFunction(taskFunctionName as string) @@ -396,10 +396,14 @@ export abstract class AbstractWorker< this.sendToMainWorker({ taskFunctionOperation, taskFunctionOperationStatus: response.status, - workerError: { - name: taskFunctionName as string, - message: this.handleError(response.error as Error | string) - } + taskFunctionName, + ...(!response.status && + response?.error != null && { + workerError: { + name: taskFunctionName as string, + message: this.handleError(response.error as Error | string) + } + }) }) }