call onErrorAction

This commit is contained in:
Alexander Bubnov 2017-03-28 14:07:53 +03:00
parent 44a6e79c09
commit 800a15fba6
1 changed files with 10 additions and 1 deletions

View File

@ -28,6 +28,7 @@ import rx.Observable;
import rx.Single; import rx.Single;
import rx.Subscription; import rx.Subscription;
import rx.android.schedulers.AndroidSchedulers; import rx.android.schedulers.AndroidSchedulers;
import rx.exceptions.OnErrorThrowable;
import rx.functions.Action0; import rx.functions.Action0;
import rx.functions.Action1; import rx.functions.Action1;
import rx.functions.Actions; import rx.functions.Actions;
@ -250,7 +251,15 @@ public class BaseLifecycleBindable implements LifecycleBindable {
actualObservable = observable.observeOn(AndroidSchedulers.mainThread()) actualObservable = observable.observeOn(AndroidSchedulers.mainThread())
.doOnCompleted(onCompletedAction) .doOnCompleted(onCompletedAction)
.doOnNext(onNextAction) .doOnNext(onNextAction)
.onErrorResumeNext(Observable.empty()); .onErrorResumeNext(throwable -> {
final boolean isRxError = throwable instanceof OnErrorThrowable;
if ((!isRxError && throwable instanceof RuntimeException)
|| (isRxError && throwable.getCause() instanceof RuntimeException)) {
Lc.assertion(throwable);
}
onErrorAction.call(throwable);
return Observable.empty();
});
} }
return isCreatedSubject.first() return isCreatedSubject.first()