Skip to content

Commit e0532b7

Browse files
luis-cortesakarnokd
authored andcommitted
Add "error handling" java docs section to from callable & co (#6193)
* #6179 Adding Error handling javadocs to Observable#fromCallable(), Single#fromCallable(), and Completable#fromCallable(). * #6179 Adding Error handling javadocs to Maybe#fromAction() and Completable#fromAction(). * #6179 Removing cancellation language since only the `Flowable` type has `cancel()` * #6179 Adding error handling JavaDocs to Flowable#fromCallable()
1 parent 205fea6 commit e0532b7

File tree

5 files changed

+42
-1
lines changed

5 files changed

+42
-1
lines changed

src/main/java/io/reactivex/Completable.java

+14
Original file line numberDiff line numberDiff line change
@@ -396,6 +396,13 @@ public static Completable error(final Throwable error) {
396396
* <dl>
397397
* <dt><b>Scheduler:</b></dt>
398398
* <dd>{@code fromAction} does not operate by default on a particular {@link Scheduler}.</dd>
399+
* <dt><b>Error handling:</b></dt>
400+
* <dd> If the {@link Action} throws an exception, the respective {@link Throwable} is
401+
* delivered to the downstream via {@link CompletableObserver#onError(Throwable)},
402+
* except when the downstream has disposed this {@code Completable} source.
403+
* In this latter case, the {@code Throwable} is delivered to the global error handler via
404+
* {@link RxJavaPlugins#onError(Throwable)} as an {@link io.reactivex.exceptions.UndeliverableException UndeliverableException}.
405+
* </dd>
399406
* </dl>
400407
* @param run the runnable to run for each subscriber
401408
* @return the new Completable instance
@@ -416,6 +423,13 @@ public static Completable fromAction(final Action run) {
416423
* <dl>
417424
* <dt><b>Scheduler:</b></dt>
418425
* <dd>{@code fromCallable} does not operate by default on a particular {@link Scheduler}.</dd>
426+
* <dt><b>Error handling:</b></dt>
427+
* <dd> If the {@link Callable} throws an exception, the respective {@link Throwable} is
428+
* delivered to the downstream via {@link CompletableObserver#onError(Throwable)},
429+
* except when the downstream has disposed this {@code Completable} source.
430+
* In this latter case, the {@code Throwable} is delivered to the global error handler via
431+
* {@link RxJavaPlugins#onError(Throwable)} as an {@link io.reactivex.exceptions.UndeliverableException UndeliverableException}.
432+
* </dd>
419433
* </dl>
420434
* @param callable the callable instance to execute for each subscriber
421435
* @return the new Completable instance

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

+7
Original file line numberDiff line numberDiff line change
@@ -1955,6 +1955,13 @@ public static <T> Flowable<T> fromArray(T... items) {
19551955
* <dd>The operator honors backpressure from downstream.</dd>
19561956
* <dt><b>Scheduler:</b></dt>
19571957
* <dd>{@code fromCallable} does not operate by default on a particular {@link Scheduler}.</dd>
1958+
* <dt><b>Error handling:</b></dt>
1959+
* <dd> If the {@link Callable} throws an exception, the respective {@link Throwable} is
1960+
* delivered to the downstream via {@link Subscriber#onError(Throwable)},
1961+
* except when the downstream has canceled this {@code Flowable} source.
1962+
* In this latter case, the {@code Throwable} is delivered to the global error handler via
1963+
* {@link RxJavaPlugins#onError(Throwable)} as an {@link io.reactivex.exceptions.UndeliverableException UndeliverableException}.
1964+
* </dd>
19581965
* </dl>
19591966
*
19601967
* @param supplier

src/main/java/io/reactivex/Maybe.java

+7
Original file line numberDiff line numberDiff line change
@@ -657,6 +657,13 @@ public static <T> Maybe<T> error(Callable<? extends Throwable> supplier) {
657657
* <dl>
658658
* <dt><b>Scheduler:</b></dt>
659659
* <dd>{@code fromAction} does not operate by default on a particular {@link Scheduler}.</dd>
660+
* <dt><b>Error handling:</b></dt>
661+
* <dd> If the {@link Action} throws an exception, the respective {@link Throwable} is
662+
* delivered to the downstream via {@link MaybeObserver#onError(Throwable)},
663+
* except when the downstream has disposed this {@code Maybe} source.
664+
* In this latter case, the {@code Throwable} is delivered to the global error handler via
665+
* {@link RxJavaPlugins#onError(Throwable)} as an {@link io.reactivex.exceptions.UndeliverableException UndeliverableException}.
666+
* </dd>
660667
* </dl>
661668
* @param <T> the target type
662669
* @param run the runnable to run for each subscriber

src/main/java/io/reactivex/Observable.java

+7-1
Original file line numberDiff line numberDiff line change
@@ -1757,8 +1757,14 @@ public static <T> Observable<T> fromArray(T... items) {
17571757
* <dl>
17581758
* <dt><b>Scheduler:</b></dt>
17591759
* <dd>{@code fromCallable} does not operate by default on a particular {@link Scheduler}.</dd>
1760+
* <dt><b>Error handling:</b></dt>
1761+
* <dd> If the {@link Callable} throws an exception, the respective {@link Throwable} is
1762+
* delivered to the downstream via {@link Observer#onError(Throwable)},
1763+
* except when the downstream has disposed this {@code Observable} source.
1764+
* In this latter case, the {@code Throwable} is delivered to the global error handler via
1765+
* {@link RxJavaPlugins#onError(Throwable)} as an {@link io.reactivex.exceptions.UndeliverableException UndeliverableException}.
1766+
* </dd>
17601767
* </dl>
1761-
*
17621768
* @param supplier
17631769
* a function, the execution of which should be deferred; {@code fromCallable} will invoke this
17641770
* function only when an observer subscribes to the ObservableSource that {@code fromCallable} returns

src/main/java/io/reactivex/Single.java

+7
Original file line numberDiff line numberDiff line change
@@ -583,6 +583,13 @@ public static <T> Single<T> error(final Throwable exception) {
583583
* <dl>
584584
* <dt><b>Scheduler:</b></dt>
585585
* <dd>{@code fromCallable} does not operate by default on a particular {@link Scheduler}.</dd>
586+
* <dt><b>Error handling:</b></dt>
587+
* <dd> If the {@link Callable} throws an exception, the respective {@link Throwable} is
588+
* delivered to the downstream via {@link SingleObserver#onError(Throwable)},
589+
* except when the downstream has disposed this {@code Single} source.
590+
* In this latter case, the {@code Throwable} is delivered to the global error handler via
591+
* {@link RxJavaPlugins#onError(Throwable)} as an {@link io.reactivex.exceptions.UndeliverableException UndeliverableException}.
592+
* </dd>
586593
* </dl>
587594
*
588595
* @param callable

0 commit comments

Comments
 (0)