Hi all, I'm playing with Flow and error handling. I'm doing somethink like:
(1..5).asFlow().onEach{ //throw error }.retryWhen { c, a -> ... }
But the flow restarts from the beginning. What is the best way to skip the emitted element that cause the error and restart from the next one?
s
streetsofboston
10/22/2019, 3:08 PM
Flows, like Observable/Flowables in Rx, terminate/complete when an error occurs. You cannot resume the upstream Flow/Observable.
At best you can return a non-error value, but the Flow/Observable still terminates, or you can restart the upstream Flow/Observable entirely (it basically will re-collect/re-subscribe).
d
davide
10/22/2019, 3:10 PM
ok, so the only way may we using catch method with emitAll on a new flux that starts from the next element