Skip to content

Commit a694145

Browse files
authored
2.x: Describe merge() error handling. (#5781)
1 parent 8b11ea8 commit a694145

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

src/main/java/io/reactivex/Flowable.java

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2965,6 +2965,19 @@ public static <T> Flowable<T> mergeArray(int maxConcurrency, int bufferSize, Pub
29652965
* backpressure; if violated, the operator <em>may</em> signal {@code MissingBackpressureException}.</dd>
29662966
* <dt><b>Scheduler:</b></dt>
29672967
* <dd>{@code merge} does not operate by default on a particular {@link Scheduler}.</dd>
2968+
* <dt><b>Error handling:</b></dt>
2969+
* <dd>If any of the source {@code Publisher}s signal a {@code Throwable} via {@code onError}, the resulting
2970+
* {@code Flowable} terminates with that {@code Throwable} and all other source {@code Publisher}s are cancelled.
2971+
* If more than one {@code Publisher} signals an error, the resulting {@code Flowable} may terminate with the
2972+
* first one's error or, depending on the concurrency of the sources, may terminate with a
2973+
* {@code CompositeException} containing two or more of the various error signals.
2974+
* {@code Throwable}s that didn't make into the composite will be sent (individually) to the global error handler via
2975+
* {@link RxJavaPlugins#onError(Throwable)} method as <em>undeliverable errors</em>. Similarly, {@code Throwable}s
2976+
* signaled by source(s) after the returned {@code Flowable} has been cancelled or terminated with a
2977+
* (composite) error will be sent to the same global error handler.
2978+
* Use {@link #mergeDelayError(Iterable)} to merge sources and terminate only when all source {@code Publisher}s
2979+
* have completed or failed with an error.
2980+
* </dd>
29682981
* </dl>
29692982
*
29702983
* @param <T> the common element base type
@@ -2973,6 +2986,7 @@ public static <T> Flowable<T> mergeArray(int maxConcurrency, int bufferSize, Pub
29732986
* @return a Flowable that emits items that are the result of flattening the items emitted by the
29742987
* Publishers in the Iterable
29752988
* @see <a href="http://reactivex.io/documentation/operators/merge.html">ReactiveX operators documentation: Merge</a>
2989+
* @see #mergeDelayError(Iterable)
29762990
*/
29772991
@SuppressWarnings({ "unchecked", "rawtypes" })
29782992
@CheckReturnValue

0 commit comments

Comments
 (0)