DEFAULT_TASK_NAME,
this.taskFunctions.get(name) as TaskFunction<Data, Response>
)
+ this.sendTaskFunctionNamesToMainWorker()
return { status: true }
} catch (error) {
return { status: false, error: error as Error }
protected handleTaskFunctionOperationMessage (
message: MessageValue<Data>
): void {
- const { taskFunctionOperation, taskFunction, taskFunctionName } = message
+ const { taskFunctionOperation, taskFunctionName, taskFunction } = message
let response!: TaskFunctionOperationReturnType
if (taskFunctionOperation === 'add') {
response = this.addTaskFunction(
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)
+ }
+ })
})
}
taskPerformance,
taskId
})
- return null
+ return undefined
})
.catch(error => {
this.sendToMainWorker({