How to properly handle onError inside RxJava (Android)?

.doOnError() is an operator, and is not as such a part of the Subscriber.

Therefore, having a .doOnError() does not count as an implemented onError().

About the question in one of the comments, of course it is possible to use lambdas.

In this case simply replace

.doOnError(throwable -> L.e(TAG, "Throwable " + throwable.getMessage()))
.subscribe(s -> createListView(s, view))

with

.subscribe(s -> createListView(s, view),
    throwable -> L.e(TAG, "Throwable " + throwable.getMessage()))

Leave a Comment