How To Recover From Errors In Rxjs?
I'm trying to understand how to consume observable sequences and how to recover from errors. My example is a bit contrived but my real implementation is a bit too complex to show h
Solution 1:
If you want to send the request again, you may want to look into retry
and retryWhen
instead of catch
.
catch
will use the returned Observable
as new "source". See this bin for an example.
retry(When)
will "re-subscribe" whenever an error occurs, based on the configuration you pass to the operators. You can find examples and more information here: https://www.learnrxjs.io/operators/error_handling/retrywhen.html
Post a Comment for "How To Recover From Errors In Rxjs?"