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

@Injectable()
export class CameraErrorHandler extends ErrorHandler {
  public notAllowed = new BehaviorSubject<boolean>(false);
  constructor() {
    super();
  }
  handleError(error: any) {
    try {
      if (error.message != null && error.message.indexOf('NotAllowedError') !== -1) {
        this.notAllowed.next(true);
      } else {
        super.handleError(error);
      }
    } catch (e) {}
  }
}
