Created
January 29, 2018 15:23
-
-
Save AhsanAyaz/aca5bc4237e63ef88330ea2b48224c4a to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { Pro } from '@ionic/pro'; | |
import { Injectable, ErrorHandler, Injector } from '@angular/core'; | |
import { IonicErrorHandler } from 'ionic-angular'; | |
// initializing the Ionic Pro client | |
const IonicPro = Pro.init('APP_ID', { | |
appVersion: "APP_VERSION" | |
}); | |
@Injectable() | |
export class AppErrorHandlerProvider implements ErrorHandler { | |
ionicErrorHandler: IonicErrorHandler; | |
constructor(injector: Injector) { | |
try { | |
this.ionicErrorHandler = injector.get(IonicErrorHandler); | |
} catch(e) { | |
// Unable to get the IonicErrorHandler provider, ensure | |
// IonicErrorHandler has been added to the providers list below | |
} | |
} | |
handleError(err: any): void { | |
IonicPro.monitoring.handleNewError(err); // Remove this if you want to disable Ionic's auto exception handling in development mode. | |
this.ionicErrorHandler && this.ionicErrorHandler.handleError(err); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment