Browse Source

Undelivered exception ignored for parallel api request

master
Preyea Regmi 5 years ago
parent
commit
4d1cae0a44
  1. 10
      app/src/main/java/com/gmeremit/online/gmeremittance_native/topup/local/presenter/topup/LocalTopUpPresenter.java

10
app/src/main/java/com/gmeremit/online/gmeremittance_native/topup/local/presenter/topup/LocalTopUpPresenter.java

@ -30,7 +30,9 @@ import java.util.regex.Pattern;
import io.reactivex.Observable;
import io.reactivex.android.schedulers.AndroidSchedulers;
import io.reactivex.disposables.CompositeDisposable;
import io.reactivex.exceptions.UndeliverableException;
import io.reactivex.observers.DisposableObserver;
import io.reactivex.plugins.RxJavaPlugins;
import io.reactivex.schedulers.Schedulers;
import io.reactivex.subjects.BehaviorSubject;
import retrofit2.HttpException;
@ -63,6 +65,14 @@ public class LocalTopUpPresenter extends BasePresenter implements LocalTopUpPres
this.fixedTopUpValidator = new FixedTopUpValidator();
this.dataTopUpValidator = new DataTopUpValidator();
RxJavaPlugins.setErrorHandler(throwable -> {
if (throwable instanceof UndeliverableException && throwable.getCause() instanceof HttpException) {
return; // ignore BleExceptions as they were surely delivered at least once
}
// add other custom handlers if needed
throw new RuntimeException("Unexpected Throwable in RxJavaPlugins error handler", throwable);
});
}
@Override

Loading…
Cancel
Save