Skip to content Skip to sidebar Skip to footer

Why Rxjava With Retrofit On Android Doonerror() Does Not Work But Subscriber Onerror Does

can someone explain me why code like this: networApi.getList() .subscribeOn(Schedulers.newThread()) .observeOn(AndroidSchedulers.mainThread())

Solution 1:

Basically, doOnError does not handle the error, in the sense that it does not consume it. It just does something with it, log it, for example. (The same is true for doOnNext - it also does not consume the item and the item still ends up in onNext of the Subscriber).

The error is still sent down the chain and would still end up in the onError of your Subscriber.

I am pretty certain that your app is crashing with an OnErrorNotImplementedException and that is because you don't have any Subscriber at all and therefore no onError method.

Post a Comment for "Why Rxjava With Retrofit On Android Doonerror() Does Not Work But Subscriber Onerror Does"