How does RxJs Retry Operator Work?

Georgi Parlakov
Apr 27, 2021

With working code and examples!

Turns out, retry operator, like many others subscribes to the observable that it is applied on.
What’s different is that retry works on the error case. On the error case it re-subscribes to the source observable as many times as attempts it was given.

So retry(2) will listen for error and retry once, then listen for another error and retry a second time and then on the third error it will give up and let the error bubble up to your error handler.

For more details, code, and step by step head over https://www.educative.io/edpresso/what-is-the-rxjs-retry-operator-and-how-does-it-work

--

--

Georgi Parlakov

Angular and DotNet dev. RxJs explorer. Testing proponent. A dad. Educative.io course author. https://gparlakov.github.io/