Ionic 2 Integration

The architecture of Ionic 2 is totally different from Ionic 1. So you need to follow different methods to capture errors from Ionic 2 apps.

1. Custom error handler

You need to create separate error handler to notify errors to Atatus.

// /src/app/atatus.handler.ts
import { IonicErrorHandler } from 'ionic-angular';
declare var atatus: any;

class AtatusErrorHandler extends IonicErrorHandler {
  handleError(error:any) : void {
    super.handleError(error);

    if (atatus) {
      // Send the error to Atatus
      atatus.notify(error.originalError || error);
    }
  }
}

export default AtatusErrorHandler;
2. Use AtatusErrorHandler

Replace IonicErrorHandler with AtatusErrorHandler in the providers section of @NgModule

// /src/app/app.module.ts
import { ErrorHandler } from '@angular/core';
import AtatusErrorHandler from './atatus.handler';

@NgModule({
    // ...
    providers: [{provide: ErrorHandler, useClass: AtatusErrorHandler}]
})

export class AppModule { }
Document Sections