I have an issue when I try to catch the last error after a few retries of a HttpClient.post. The retries and delay work fine, but I would like at the end (after the last retry has failed) that I end up in my manageError function. Thanks for your help
this.httpClient.post<any>(url, payload)
.pipe(
retryWhen((error) => {
return error.pipe(delay(TIMER_BETWEEN_REQUESTS), take(NUMBER_OF_RETRY),
catchError(err=>throwError(() => "getUnidentifiedBag has failed " + NUMBER_OF_RETRY + " times: " + err)))}
)
)
.subscribe({ next: (response) => {
console.log("response = ", JSON.stringify(response));
}, error: (err) => {
this.manageError(JSON.stringify(err), SEARCH_ERROR_MESSAGE);
}
});