小编Rox*_*Rox的帖子

如何使用RxJava在onNext()中抛出错误

.subscribe(
    new Action1<Response>() {
        @Override
        public void call(Response response) {
            if (response.isSuccess())
            //handle success
            else
            //throw an Throwable(reponse.getMessage())
        }
    },
    new Action1<Throwable>() {
        @Override
        public void call(Throwable throwable) {
            //handle Throwable throw from onNext();
        }
    }
);
Run Code Online (Sandbox Code Playgroud)

我不想处理(!response.isSuccess())onNext().我怎么能把它扔到onError()另一个扔掉的处理?

java rx-java

12
推荐指数
2
解决办法
1万
查看次数

标签 统计

java ×1

rx-java ×1