refactor: cleanup worker.addTaskFunction()
authorJérôme Benoit <jerome.benoit@sap.com>
Sun, 16 Jul 2023 17:42:14 +0000 (19:42 +0200)
committerJérôme Benoit <jerome.benoit@sap.com>
Sun, 16 Jul 2023 17:42:14 +0000 (19:42 +0200)
Signed-off-by: Jérôme Benoit <jerome.benoit@sap.com>
src/worker/abstract-worker.ts

index 8a6b2104317a7a229dbca9943497b21e5e26f66f..7d5494deeb3bbe80d2a725bd6ef0d685ca288775 100644 (file)
@@ -198,8 +198,8 @@ export abstract class AbstractWorker<
     if (typeof fn !== 'function') {
       throw new TypeError('fn parameter is not a function')
     }
-    const boundFn = fn.bind(this)
     try {
+      const boundFn = fn.bind(this)
       if (
         this.taskFunctions.get(name) ===
         this.taskFunctions.get(DEFAULT_TASK_NAME)