We are using RxAndroid + retrofit for our api calls.
I sort of understand why any exceptions within the sequence will pass the Throwable through onError().
But how do you end the sequence, how do you then process a response and return to throwing fatal exceptions again? I would have expected processing in onCompleted() would allow this, but I'm still seeing onError() being called.
Simplified snippet below. Gives the result -
throwable: Attempt to invoke virtual method 'boolean java.util.ArrayList.add(java.lang.Object)' on a null object reference
Observable<ResponseModel> observable = getApiCallObservable();
AppObservable.bindFragment(this, observable)
.subscribeOn(AndroidSchedulers.mainThread())
.subscribe(new Observer<ResponseModel>() {
@Override
public void onCompleted() {
uninitializedList.add("item");
}
@Override
public void onError(Throwable e) {
Log.e(TAG, "throwable: " + e.getMessage());
}
@Override
public void onNext(ResponseModel response) {
}
});
thanks for any help