redoc/lib/utils/custom-error-handler.ts

14 lines
385 B
TypeScript
Raw Normal View History

2016-10-23 20:18:42 +03:00
import { ErrorHandler, Injectable } from '@angular/core';
import { AppStateService } from '../services/app-state.service';
@Injectable()
2016-10-30 18:54:44 +03:00
export class CustomErrorHandler extends ErrorHandler {
2016-10-23 20:18:42 +03:00
constructor(private appState: AppStateService) {
2017-03-29 13:29:54 +03:00
super();
2016-10-23 20:18:42 +03:00
}
handleError(error) {
2016-10-31 10:16:39 +03:00
this.appState.error.next(error && error.rejection || error);
2016-10-30 18:54:44 +03:00
super.handleError(error);
2016-10-23 20:18:42 +03:00
}
}