Я пытаюсь добавить перехватчик обработки ошибок с rxjs, но у меня проблема с его компиляцией, потому что "catch" мигает красным
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);
});
}
}