IonicErrorHandler in Ionic v4

The IonicErrorHandler has been deprecated in favor of the ErrorHandler of Angular in Ionic v4? Is that correct?

IonicErrorHandler was designed (primarily) for use during Development (e.g., when running ionic serve).

You should provide your own Production version of ErrorHandler.

core.module.ts:

import { ENV } from '@env';

@NgModule({
  imports: [
    ...
    ServiceWorkerModule.register('/ngsw-worker.js', { enabled: ENV.production }),
    ...
  ],
  exports: [],
  declarations: [],
  providers: [
    ...
    ENV.production ? { provide: ErrorHandler, useClass: BrewErrorHandler } :
      { provide: ErrorHandler, useClass: IonicErrorHandler},
    ...
  ]
})
export class CoreModule {
    ...
  }
}

error.handler.ts

import { ErrorHandler, Injectable } from '@angular/core';

@Injectable()
export class BrewErrorHandler extends ErrorHandler {

  constructor() {
    super();
  }

  handleError(error: any): void {
    ...
  }
}

app.module.ts:

@NgModule({
  declarations: [ AppComponent ],
  imports: [
    BrowserModule,
    CoreModule,
    IonicModule.forRoot(AppComponent, {
      backButtonText: ''
    })
  ],
  bootstrap: [ IonicApp ],
  entryComponents: [ AppComponent ],
  providers: []
})
export class AppModule {}

See:

thx @robinyo for the answer, that confirm what I was thinking. For my Sentry handler I should not extend IonicErrorHandler anymore but the ErrorHandler from Angular

P.S.: Thx for your example, interesting the part where you use the ENV to use a different handler.

Note, I didn’t find any IonicErrorHandler class, might be deprecated or just not implemented yet in the current version