more flexible error interceptor

This commit is contained in:
Timo Bejan 2021-08-25 15:48:48 +03:00
parent 4632bde685
commit ccbe4eace5

View File

@ -12,7 +12,9 @@ export class ServerErrorInterceptor implements HttpInterceptor {
return next.handle(req).pipe(
map((event: HttpEvent<any>) => event),
catchError((error: HttpErrorResponse) => {
if ([0, 500].includes(error.status)) this._errorService.set(error);
if (error.status >= 500 || error.status === 0) {
this._errorService.set(error);
}
return throwError(error);
})
);