can someone explain me why code like this:
networApi.getList()
.subscribeOn(Schedulers.newThread())
.observeOn(AndroidSchedulers.mainThread())
.doOnError(throwable -> {
throwable.getMessage();
})
.doOnNext(list -> {
coursesView.populateRecyclerView(list);
courseList = (List<Course>) courses;
}).subscribe();
If there is no internet goes into doOnError but throws it further so the app goes down, but code like this:
networkApi.getList()
.subscribeOn(Schedulers.newThread())
.observeOn(AndroidSchedulers.mainThread())
.subscribe(new Subscriber<List<? extends Course>>() {
@Override
public void onCompleted() {
}
@Override
public void onError(Throwable e) {
e.getMessage();
}
@Override
public void onNext(List<? extends Course> list) {
coursesView.populateRecyclerView(list);
courseList = (List<Course>) list;
}
});
Work how I expect, it means when there is no internet connection it does nothing.