I created an interceptor to catch all the errors using angle 6, but catch returns this message.
intercept(req: HttpRequest<any>, next: HttpHandler): Observable<HttpEvent<any>>{
return next.handle(req)
.catch((error, caught) => {
(....)
return Observable.throw(errorObj);
}) as any;
};
}
I researched a lot and found that in angle 6 should be used o:
import { catchError } from 'rxjs/operators';
import { throwError, Observable } from 'rxjs';
But things do not work out here either. I also tried the:
import 'rxjs/add/operator/catch';
But the angle says: Module not found: Error: Can not resolve 'rxjs / add / operator / catch' in '...'