Skip to content

Commit

Permalink
Merge pull request square#1986 from square/jw/throw-fatal
Browse files Browse the repository at this point in the history
Propagate fatal exceptions even if already dispatching an error.
  • Loading branch information
swankjesse authored Aug 21, 2016
2 parents e02fb37 + 240e3cd commit 34eb99f
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
import rx.Observable.OnSubscribe;
import rx.Subscriber;
import rx.exceptions.CompositeException;
import rx.exceptions.Exceptions;
import rx.plugins.RxJavaPlugins;

final class BodyOnSubscribe<T> implements OnSubscribe<T> {
Expand Down Expand Up @@ -51,6 +52,7 @@ private static class BodySubscriber<R> extends Subscriber<Response<R>> {
try {
subscriber.onError(t);
} catch (Throwable inner) {
Exceptions.throwIfFatal(inner);
CompositeException composite = new CompositeException(t, inner);
RxJavaPlugins.getInstance().getErrorHandler().handleError(composite);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,7 @@ private static final class CallArbiter<T> extends AtomicBoolean
try {
subscriber.onError(t);
} catch (Throwable inner) {
Exceptions.throwIfFatal(inner);
CompositeException composite = new CompositeException(t, inner);
RxJavaPlugins.getInstance().getErrorHandler().handleError(composite);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
import rx.Observable.OnSubscribe;
import rx.Subscriber;
import rx.exceptions.CompositeException;
import rx.exceptions.Exceptions;
import rx.plugins.RxJavaPlugins;

final class ResultOnSubscribe<T> implements OnSubscribe<Result<T>> {
Expand Down Expand Up @@ -51,6 +52,7 @@ private static class ResultSubscriber<R> extends Subscriber<Response<R>> {
try {
subscriber.onError(t);
} catch (Throwable inner) {
Exceptions.throwIfFatal(inner);
CompositeException composite = new CompositeException(t, inner);
RxJavaPlugins.getInstance().getErrorHandler().handleError(composite);
}
Expand Down

0 comments on commit 34eb99f

Please sign in to comment.