- this.port = message.port
- this.port.on('message', this.messageListener.bind(this))
- this.sendTaskFunctionsListToMainWorker()
- this.sendToMainWorker({ ready: true, workerId: this.id })
+ try {
+ this.port = message.port
+ this.port.on('message', this.messageListener.bind(this))
+ this.sendToMainWorker({
+ ready: true,
+ taskFunctionNames: this.listTaskFunctionNames()
+ })
+ } catch {
+ this.sendToMainWorker({
+ ready: false,
+ taskFunctionNames: this.listTaskFunctionNames()
+ })
+ }