Global Error handler not so global

So I have a global error handler in my ionic app…

When an error is triggered within an rxjs pipe … the handler will receive the error and is sent to the server

But errors on other parts of the code never make it to the global error handler.

I’m on ionic 5. Any ideas?

--- app.module.ts
{ provide: ErrorHandler, useClass: GlobalErrorHandler, deps: [ErrorService] }


--- my global error handler class
import { ErrorService } from "src/app/services/common/error.service";
import { ErrorHandler } from "@angular/core";

export class GlobalErrorHandler extends ErrorHandler {
  constructor(private errorService: ErrorService){
    super()
  }     
      
  handleError(error: any): void {
    // here my code sends the error to the server                            
  }                                                                            
}                                                                              

Sounds to me that only “ngZone” or “angular” errors are being handled by this. Is there a way I can catch ALL errors?

So for instance, where this is going to throw an exception:

sector.images.first().routes.first().pitches.first().name

this is catched by my error hanlder:

apiDownload(sector: Sector): {sector: Observable<Sector>, progress: BehaviorSubject<number>} {
  const sector$ = this.apiGet(sector).pipe(
    tap(() => sector.images.first().routes.first().pitches.first().name),
  );
} 

and this is not:

apiDownload(sector: Sector): {sector: Observable<Sector>, progress: BehaviorSubject<number>} {
  sector.images.first().routes.first().pitches.first().name
}