I'm facing an issue with my RxJS code where I need to continuously retry a data request upon failure while also handling the error. Currently, I am using the retry operator for this purpose. However, when attempting to subscribe to the retry operator as shown in this article, I encounter the error TS2339: Property subscribe does not exist on type MonoTypeOperatorFunction.
Is there a way to effectively handle errors with the retry operator without resorting to the deprecated retryWhen method?
const interval = 2000;
this.xyzService.getData()
.pipe(
takeUntil(this.destroy$),
retry({
delay: interval,
resetOnSuccess: true
}),
//catchError(() => {
// ...handling error...
// return EMPTY;
//}),
map((response) => {
this.data = response.body;
this.state = 'LOADED';
}),
delay(interval),
repeat(),
).subscribe();