Revision 60973
Added by Konstantinos Triantafyllou almost 3 years ago
error-interceptor.service.ts | ||
---|---|---|
1 | 1 |
import {Injectable} from "@angular/core"; |
2 | 2 |
import {HttpEvent, HttpHandler, HttpInterceptor, HttpRequest} from "@angular/common/http"; |
3 |
import {Observable, throwError} from "rxjs"; |
|
3 |
import {Observable, throwError, TimeoutError} from "rxjs";
|
|
4 | 4 |
import {catchError} from "rxjs/operators"; |
5 | 5 |
import {Session} from "./login/utils/helper.class"; |
6 | 6 |
import {Router} from "@angular/router"; |
... | ... | |
18 | 18 |
|
19 | 19 |
intercept(req: HttpRequest<any>, next: HttpHandler): Observable<HttpEvent<any>> { |
20 | 20 |
return next.handle(req).pipe(catchError(err => { |
21 |
if(err instanceof TimeoutError) { |
|
22 |
console.error(req.url, "Timeout"); |
|
23 |
} |
|
21 | 24 |
if ((err.status === 0 && properties.registryUrl && this.isService(req, properties.registryUrl) && req.method !== 'GET') || |
22 | 25 |
(err.status === 401 && !this.isService(req, ErrorInterceptorService.UNAUTHORIZED_WHITELIST))) { |
23 | 26 |
this.logOut(); |
Also available in: Unified diff
[Library | Trunk]: Print timeout error request on error interceptor