下面的Log.d(...)
块中的catch(...)
表达式被执行(我可以看到Android Studio中的日志输出),但调试器不会停在设置在同一行的断点处。这是为什么?调试器在其他断点处停止。
Observable.create(new Observable.OnSubscribe<MobileBankIdSessionResponse.MobileBankIdSession>() {
@Override
public void call(final Subscriber<? super MobileBankIdSessionResponse.MobileBankIdSession> subscriber) {
Schedulers.newThread().createWorker().schedule(new Action0() {
@Override
public void call() {
try {
MobileBankIdSessionResponse r = User.getMobileBankIdSession(reference, nationalIdentity).toBlocking().first();
String progressCode = r.getResponse().progress.progressCode;
if (StringUtils.equals(progressCode, "COMPLETE")) {
subscriber.onNext(r.getResponse());
subscriber.onCompleted();
} else if (StringUtils.equals(progressCode, "USER_SIGN")
|| StringUtils.equals(progressCode, "OUTSTANDING_TRANSACTION")) {
Schedulers.newThread().createWorker().schedule(this, 2, TimeUnit.SECONDS);
} else if (StringUtils.equals(progressCode, "NO_CLIENT")) {
subscriber.onError(new Throwable("Fel vid signering"));
}
} catch (Exception e) {
Log.d("AtError", "here");
subscriber.onError(e);
}
}
});
}
}).observeOn(AndroidSchedulers.mainThread()).subscribe(new Observer<MobileBankIdSessionResponse.MobileBankIdSession>() {
@Override
public void onCompleted() {}
@Override
public void onError(Throwable throwable) {
mUserLoggedInOutSubject.onNext(Pair.create(throwable.getMessage(), LoginStates.ERROR));
}
@Override
public void onNext(MobileBankIdSessionResponse.MobileBankIdSession mobileBankIdSession) {
setSession(mobileBankIdSession.session, nationalIdentity);
}
});
答案 0 :(得分:0)
对于来这里回答问题的任何人,可能您没有在使用的Single,Flowable等对象上调用.subscribe(e ->{});
。