Search code examples
javarx-javareactivex

RxJava retryWhen and onError


I am starting to developing using rxJava, and I have the following situation:

I have a observable and I want to have one subscriber to handle the error onError, and other subscriber to handle the retryWhen.

The retryWhen swallow the error, how avoid the error swallow?


Solution

  • You can put doOnError/doOnEach before retryWhen like this:

        o.doOnError(t -> {
          // do something 
        }).retryWhen(o -> {
          // do something
        });