1

Using RxView to handle the clicks I have to implement the onError. I understand that the onError is always there in observers but is there a case when the RxView.clicks(myview) will actually call onError?

    RxView.clicks(buttonView).ignoreElements().subscribeWith(new DisposableCompletableObserver() {
        @Override
        public void onComplete() {

        }

        @Override
        public void onError(@io.reactivex.annotations.NonNull Throwable e) {
            // when would this be called?
        }

    });

Is it a good pattern to define a class that implements an empty onError assuming that it will never be called? I did not find anything stating that this is true but I can't think about a case when the onError will actually be called

1048576
  • 615
  • 9
  • 27

1 Answers1

0

I ended doing this:

RxView.clicks(buttonView).ignoreElements().subscribeWith(aVoid -> {});

So here I'm passing a Consumer instead of an Observer. This of course means that I'm assuming I do not need to handle the error.

1048576
  • 615
  • 9
  • 27