File tree 3 files changed +13
-0
lines changed
src/main/java/io/reactivex
internal/operators/completable
3 files changed +13
-0
lines changed Original file line number Diff line number Diff line change @@ -508,6 +508,13 @@ public static <T> Completable fromMaybe(final MaybeSource<T> maybe) {
508
508
* <dl>
509
509
* <dt><b>Scheduler:</b></dt>
510
510
* <dd>{@code fromRunnable} does not operate by default on a particular {@link Scheduler}.</dd>
511
+ * <dt><b>Error handling:</b></dt>
512
+ * <dd> If the {@link Runnable} throws an exception, the respective {@link Throwable} is
513
+ * delivered to the downstream via {@link CompletableObserver#onError(Throwable)},
514
+ * except when the downstream has disposed this {@code Completable} source.
515
+ * In this latter case, the {@code Throwable} is delivered to the global error handler via
516
+ * {@link RxJavaPlugins#onError(Throwable)} as an {@link io.reactivex.exceptions.UndeliverableException UndeliverableException}.
517
+ * </dd>
511
518
* </dl>
512
519
* @param run the runnable to run for each subscriber
513
520
* @return the new Completable instance
Original file line number Diff line number Diff line change 17
17
import io .reactivex .disposables .*;
18
18
import io .reactivex .exceptions .Exceptions ;
19
19
import io .reactivex .functions .Action ;
20
+ import io .reactivex .plugins .RxJavaPlugins ;
20
21
21
22
public final class CompletableFromAction extends Completable {
22
23
@@ -36,6 +37,8 @@ protected void subscribeActual(CompletableObserver observer) {
36
37
Exceptions .throwIfFatal (e );
37
38
if (!d .isDisposed ()) {
38
39
observer .onError (e );
40
+ } else {
41
+ RxJavaPlugins .onError (e );
39
42
}
40
43
return ;
41
44
}
Original file line number Diff line number Diff line change 18
18
import io .reactivex .disposables .Disposable ;
19
19
import io .reactivex .disposables .Disposables ;
20
20
import io .reactivex .exceptions .Exceptions ;
21
+ import io .reactivex .plugins .RxJavaPlugins ;
21
22
22
23
public final class CompletableFromRunnable extends Completable {
23
24
@@ -37,6 +38,8 @@ protected void subscribeActual(CompletableObserver observer) {
37
38
Exceptions .throwIfFatal (e );
38
39
if (!d .isDisposed ()) {
39
40
observer .onError (e );
41
+ } else {
42
+ RxJavaPlugins .onError (e );
40
43
}
41
44
return ;
42
45
}
You can’t perform that action at this time.
0 commit comments