In the documentation for RetryWhen the example there goes like this:
Observable.create((Subscriber<? super String> s) -> {
System.out.println("subscribing");
s.onError(new RuntimeException("always fails"));
}).retryWhen(attempts -> {
return attempts.zipWith(Observable.range(1, 3), (n, i) -> i).flatMap(i -> {
System.out.println("delay retry by " + i + " second(s)");
return Observable.timer(i, TimeUnit.SECONDS);
});
}).toBlocking().forEach(System.out::println);
But how do I propagate the Error if the retries runs out?
Adding .doOnError(System.out::println)
after the retryWhen
clause does not catch the error. Is it even emitted?
Adding a .doOnError(System.out::println)
before retryWhen displays always fails
for all retries.