Description
Hi,
I'm stuck on a problem which might or might not be an issue on the current version of the ParallelFlowable
, or if it is a desired behaviour, it's not specified anywhere in the documentation.
In a few words, I'm having issues propagating errors from a ParallelFlowable
to a single Flowable
(when calling sequential()
).
What I would expect is that any error generated during the execution of operators on the ParallelFlowable
would be propagated to the subscriber on the Flowable.
What really happens is that the exception is not propagated, and it's thrown even if it's a checked exception.
Here is a code example:
Flowable.just(request1, request2)
.parallel() // parallel execution is needed
.runOn(Schedulers.io())
.map(request -> request.execute()) // execute() can throw an exception
.sequential()
.toList()
.observeOn(AndroidSchedulers.mainThread())
.subscribe(this::success, this::failure);
failure(exception)
is not called, and the exception is actually thrown.
I've also tried this and the exception is still not propagated to the sequential Flowable:
Flowable.just(request1, request2)
.parallel() // parallel execution is needed
.runOn(Schedulers.io())
.flatMap(request -> {
try {
return Flowable.just(request.execute());
} catch (Exception e) {
return Flowable.error(e);
}
}
.sequential()
...
I'm using version 2.0.5 of RxJava on Android.
Thank you for your help.