您的位置:首页 > 编程语言 > Java开发

记一个用RxJava遇到的问题

2016-01-12 15:22 561 查看
问题的现象是Observer的onNext方法被调用后,它的onError方法也紧跟着被调用了……我的第一反应是RxJava的Bug?……

当然不是的……

@Override
public void onNext(T args) {
try {
if (!done) {
actual.onNext(args);
}
} catch (Throwable e) {
// we handle here instead of another method so we don't add stacks to the frame
// which can prevent it from being able to handle StackOverflow
Exceptions.throwIfFatal(e);
// handle errors if the onNext implementation fails, not just if the Observable fails
onError(e);
}
}


// handle errors if the onNext implementation fails, not just if the Observable fails

当onNext里我们的函数发生异常时,onError会被调用
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: