- this.workerOptions.poolOptions.exitHandler =
- this.workerOptions?.poolOptions?.exitHandler ?? WorkerUtils.defaultExitHandler;
+ this.workerOptions.poolOptions.errorHandler = (
+ this.workerOptions?.poolOptions?.errorHandler ?? WorkerUtils.defaultErrorHandler
+ ).bind(this) as ErrorHandler<Worker>;
+ this.workerOptions.poolOptions.exitHandler = (
+ this.workerOptions?.poolOptions?.exitHandler ?? WorkerUtils.defaultExitHandler
+ ).bind(this) as ExitHandler<Worker>;
+ this.workerOptions.poolOptions.messageHandler.bind(this);