java - RxAndroid - how to throw fatal exceptions after onCompleted() -


we using rxandroid + retrofit our api calls.

i sort of understand why exceptions within sequence pass throwable through onerror().

but how end sequence, how process response , return throwing fatal exceptions again? have expected processing in oncompleted() allow this, i'm still seeing onerror() being called.

simplified snippet below. gives result -

throwable: attempt invoke virtual method 'boolean java.util.arraylist.add(java.lang.object)' on 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 help

i'm not sure understood being asked here. basically, if observable getapicallobservable() throws error, onerror called , should handle error accordingly in onerror. if happens, is, nothing happen anymore. if error happens, onerror called , stream end. if there no error, onnext called, , that's should response. after onnext, finally, oncompleted called.

the error showing saying arraylist uninitializedlist null, method call add() invalid.

edit. think got point now. want handle error without onerror being called observable. move oncomplete code onnext, , won't fall under onerror, throw fatal exception. it?


Comments

Popular posts from this blog

python - Healpy: From Data to Healpix map -

c - Bitwise operation with (signed) enum value -

xslt - Unnest parent nodes by child node -