当我在一个可观察的列表上使用mergeDelayError
来在错误输出之前执行每个observable时,我得到:
OnErrorFailedException: Error occurred when trying to propagate error to Observer.onError
代码:
return Observable.mergeDelayError(Observable.from(observableList));
我用onError
的参数订阅了observable(也没有执行)。
但是,当我尝试使用onErrorResumeNext
来调试它时,我发现传播可观察的错误没有引起任何问题。这里发生了什么?
return Observable.mergeDelayError(Observable.from(observableList)).onErrorResumeNext(new Func1<Throwable, Observable<? extends Pair<String, Map<Long, Set<ProgressGradedItemBL>>>>>() {
@Override
public Observable<? extends Pair<String, Map<Long, Set<ProgressGradedItemBL>>>> call(Throwable throwable) {
return Observable.error(throwable);
}
});
这是我没有onErrorResumeNext
的堆栈跟踪:
rx.exceptions.OnErrorFailedException: Error occurred when trying to propagate error to Observer.onError
at rx.observers.SafeSubscriber._onError(SafeSubscriber.java:175)
at rx.observers.SafeSubscriber.onError(SafeSubscriber.java:97)
at rx.internal.operators.OperatorMerge$MergeSubscriber.drainAndComplete(OperatorMerge.java:466)
at rx.internal.operators.OperatorMerge$MergeSubscriber.completeInner(OperatorMerge.java:449)
at rx.internal.operators.OperatorMerge$InnerSubscriber.emit(OperatorMerge.java:599)
at rx.internal.operators.OperatorMerge$InnerSubscriber.onCompleted(OperatorMerge.java:542)
at rx.internal.operators.OperatorMerge$MergeSubscriber.drainAndComplete(OperatorMerge.java:472)
at rx.internal.operators.OperatorMerge$MergeSubscriber.completeInner(OperatorMerge.java:449)
at rx.internal.operators.OperatorMerge$InnerSubscriber.emit(OperatorMerge.java:614)
at rx.internal.operators.OperatorMerge$InnerSubscriber.onCompleted(OperatorMerge.java:542)
at rx.internal.operators.OnSubscribeCombineLatest$MultiSourceProducer.tick(OnSubscribeCombineLatest.java:151)
at rx.internal.operators.OnSubscribeCombineLatest$MultiSourceProducer.onCompleted(OnSubscribeCombineLatest.java:183)
at rx.internal.operators.OnSubscribeCombineLatest$MultiSourceRequestableSubscriber.onCompleted(OnSubscribeCombineLatest.java:236)
at rx.internal.operators.OperatorMap$1.onCompleted(OperatorMap.java:43)
at rx.internal.operators.OperatorMerge$MergeSubscriber.drainAndComplete(OperatorMerge.java:472)
at rx.internal.operators.OperatorMerge$MergeSubscriber.onCompleted(OperatorMerge.java:435)
at rx.internal.operators.OperatorMap$1.onCompleted(OperatorMap.java:43)
at rx.internal.operators.OperatorMerge$MergeSubscriber.drainAndComplete(OperatorMerge.java:472)
at rx.internal.operators.OperatorMerge$MergeSubscriber.completeInner(OperatorMerge.java:449)
at rx.internal.operators.OperatorMerge$InnerSubscriber.emit(OperatorMerge.java:614)
at rx.internal.operators.OperatorMerge$InnerSubscriber.onCompleted(OperatorMerge.java:542)
at rx.internal.operators.OperatorMerge$MergeSubscriber.drainAndComplete(OperatorMerge.java:472)
at rx.internal.operators.OperatorMerge$MergeSubscriber.onCompleted(OperatorMerge.java:435)
at rx.internal.operators.OperatorMap$1.onCompleted(OperatorMap.java:43)
at rx.internal.operators.OperatorMerge$MergeSubscriber.drainAndComplete(OperatorMerge.java:472)
at rx.internal.operators.OperatorMerge$MergeSubscriber.completeInner(OperatorMerge.java:449)
at rx.internal.operators.OperatorMerge$InnerSubscriber.emit(OperatorMerge.java:614)
at rx.internal.operators.OperatorMerge$InnerSubscriber.onCompleted(OperatorMerge.java:542)
at rx.internal.operators.OperatorDistinctUntilChanged$1.onCompleted(OperatorDistinctUntilChanged.java:64)
at rx.internal.operators.OperatorDoOnEach$1.onCompleted(OperatorDoOnEach.java:53)
at rx.internal.operators.OperatorMap$1.onCompleted(OperatorMap.java:43)
at rx.internal.operators.OperatorFilter$1.onCompleted(OperatorFilter.java:42)
at rx.internal.operators.OperatorSubscribeOn$1$1$1.onCompleted(OperatorSubscribeOn.java:66)
at rx.observers.SerializedObserver.onCompleted(SerializedObserver.java:99)
at rx.observers.SerializedSubscriber.onCompleted(SerializedSubscriber.java:46)
at rx.internal.operators.OperatorConcat$ConcatSubscriber.subscribeNext(OperatorConcat.java:158)
at rx.internal.operators.OperatorConcat$ConcatSubscriber.completeInner(OperatorConcat.java:150)
at rx.internal.operators.OperatorConcat$ConcatInnerSubscriber.onCompleted(OperatorConcat.java:212)
at rx.internal.operators.OperatorDoOnEach$1.onCompleted(OperatorDoOnEach.java:53)
at rx.internal.operators.OperatorDoOnEach$1.onCompleted(OperatorDoOnEach.java:53)
at rx.internal.operators.OperatorMap$1.onCompleted(OperatorMap.java:43)
at rx.internal.operators.OperatorDoOnEach$1.onCompleted(OperatorDoOnEach.java:53)
答案 0 :(得分:0)
使用Scan(
Id
Name
)
EntityTypeCommon(
Id
ScanRef
...
)
Entity1Type(
Id
TypeEntityCommonRef
...
)
Entity2Type(
Id
TypeEntityCommonRef
...
)
Entity3Type(
Id
TypeEntityCommonRef
...
)
代替OnErrorFailedException
时会引发subscribe(Action1)
。此外,您似乎使用旧版本的RxJava(名称subscribe(Action1, Action1)
类似于1.0.12及之前)。目前的版本是1.1.2。
答案 1 :(得分:0)
如果你的流对Observable抛出一个未经检查的异常,则observable处理中止抛出一个OnErrorFailedException。