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

@Injectable()
export class ErrorHandlerProvider implements ErrorHandler {
    constructor(private appInsights: AppInsightService) {}

    handleError(error: any) {
        const ex = new Error(error.message);
        this.appInsights.logException(ex);
        console.error('Error has occurred: ', error);
    }
}
