I'm kinda new with Rxjs. and what I'm trying to do is call an API 5 times, but return a custom error value to my component if after 5 times the request still fails. But somehow it doesn't reach the catchError.
start(): Observable<any> {
return this.http.put<any>(`${this.apiConfig}/start`, {})
.pipe(
map(res => {
return res;
}),
retryWhen(errors => errors.pipe(delay(3000), take(4))
),
catchError(() => of({
status: "NO_CONNECTION"
}))
);
}