使用service过度error处理
This commit is contained in:
23
src/app/services/error.service.ts
Normal file
23
src/app/services/error.service.ts
Normal file
@@ -0,0 +1,23 @@
|
||||
import {Injectable, Injector} from '@angular/core';
|
||||
import {Response} from '../class/HttpReqAndResp';
|
||||
import {HttpService} from '../api/http/http.service';
|
||||
|
||||
@Injectable({
|
||||
providedIn: 'root'
|
||||
})
|
||||
export class ErrorService {
|
||||
|
||||
constructor(private httpService: HttpService) {
|
||||
}
|
||||
|
||||
public httpError(err: any) {
|
||||
console.log('error=>', err)
|
||||
// this.httpService.getSubscriptionQueue().map(a => a.unsubscribe())
|
||||
}
|
||||
|
||||
public httpException(response: Response<any>) {
|
||||
console.log('exception=>', response)
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user