I want to achieve this if I call the Obervable.subscribe(Action1) method, it does not throw an OnErrorNotImplementedException anywhere, but if I call Obervable.subscribe(Action1, Action1) , the second action is called when the error occurs as normal. I tried two ways:
.onErrorResumeNext(Observable.empty())
This OnErrorNotImplementedException not thrown, however, if I pass the second action as well, the action is never thrown.
Secondly:
.lift(new Observable.Operator<T, T>() { @Override public Subscriber<? super T> call(Subscriber<? super T> subscriber) { return new Subscriber<T>() { @Override public void onCompleted() { if (!subscriber.isUnsubscribed()) { subscriber.onCompleted(); } } @Override public void onError(Throwable e) { if (!subscriber.isUnsubscribed()) { try { subscriber.onError(e); } catch (Throwable t) { if (!(t instanceof OnErrorNotImplementedException)) { throw t; } } } } @Override public void onNext(T t) { if (!isUnsubscribed()) { subscriber.onNext(t); } } }; } });
The problem with this is if observeOn() is called later, then it will be asynchronous, and obviously my exception handling will not work here.
Is there any way to achieve this. I would like to have a subscribe() method that does not throw an OnErrorNotImplementedException into an onError .
source share