I'm trying to add error handling interceptor with rxjs but i have a problem with compiling it becouse the "catch" blinking red
intercept(req: HttpRequest<any>, next: HttpHandler): Observable<HttpSentEvent | HttpHeaderResponse | HttpProgressEvent | HttpResponse<any> | HttpUserEvent<any>> {
console.log(req);
return next.handle(req).catch(error => {
if (error instanceof HttpErrorResponse) {
this.messageService.error(`Błąd połączenia: ${error.message}`);
}
return observableThrowError(error);
});
}
}