Ionic pro montior manual handling error scenario


#1

I follow the tutorail and add these code for error handling.

@Injectable()
export class MyErrorHandler 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 {
    Pro.monitoring.handleNewError(err);
    // Remove this if you want to disable Ionic's auto exception handling
    // in development mode.
    this.ionicErrorHandler && this.ionicErrorHandler.handleError(err);
  }
}

I do not have much experience on error handling. What are the scenarios for using manual error handling functions?

Pro.monitoring.exception(new Error('error'))
Pro.monitoring.log('This happens sometimes', { level: 'error' })
Pro.monitoring.call(() => {
  throw new Error('error');
})
const newFn = Pro.monitoring.wrap(() => {
  throw new Error('error');
})
newFn();