- if (this.emitter !== undefined) {
- this.emitter.emit(WorkerSetEvents.error, error);
- }
- if (this.workerOptions?.poolOptions?.restartWorkerOnError) {
+ this.emitter?.emit(WorkerSetEvents.error, error);
+ if (this.workerOptions.poolOptions?.restartWorkerOnError) {