Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Hooked RxJavaPlugins errorHandler up within all operators that swallow onErrors #1306

Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
import rx.Notification;
import rx.Observable.Operator;
import rx.Subscriber;
import rx.plugins.RxJavaPlugins;

/**
* Turns all of the notifications from an Observable into <code>onNext</code> emissions, and marks
Expand All @@ -42,6 +43,7 @@ public void onCompleted() {

@Override
public void onError(Throwable e) {
RxJavaPlugins.getInstance().getErrorHandler().handleError(e);
child.onNext(Notification.<T> createOnError(e));
child.onCompleted();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
import rx.Subscriber;
import rx.exceptions.CompositeException;
import rx.observers.SerializedSubscriber;
import rx.plugins.RxJavaPlugins;
import rx.subscriptions.CompositeSubscription;

/**
Expand Down Expand Up @@ -125,10 +126,13 @@ public void onError(Throwable e) {
public void onCompleted() {
complete();
}

void error(Throwable e) {
RxJavaPlugins.getInstance().getErrorHandler().handleError(e);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This does eventually emit the CompositeException. Is this consciously wanting to handle each error individually instead of only via the composite?

exceptions.add(e);
complete();
}

void complete() {
if (WIP_UPDATER.decrementAndGet(this) == 0) {
if (exceptions.isEmpty()) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
import rx.Subscriber;
import rx.exceptions.OnErrorThrowable;
import rx.functions.Func1;
import rx.plugins.RxJavaPlugins;

/**
* Allows inserting onNext events into a stream when onError events are received
Expand All @@ -46,6 +47,7 @@ public void onCompleted() {
@Override
public void onError(Throwable e) {
try {
RxJavaPlugins.getInstance().getErrorHandler().handleError(e);
Observable<? extends T> resume = resumeFunction.call(OnErrorThrowable.from(e));
resume.unsafeSubscribe(new Subscriber<T>() {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
import rx.Observable.Operator;
import rx.Subscriber;
import rx.functions.Func1;
import rx.plugins.RxJavaPlugins;

/**
* Instruct an Observable to pass control to another Observable (the return value of a function)
Expand Down Expand Up @@ -59,6 +60,7 @@ public void onCompleted() {
@Override
public void onError(Throwable e) {
try {
RxJavaPlugins.getInstance().getErrorHandler().handleError(e);
Observable<? extends T> resume = resumeFunction.call(e);
resume.unsafeSubscribe(child);
} catch (Throwable e2) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
import rx.Observable;
import rx.Observable.Operator;
import rx.Subscriber;
import rx.plugins.RxJavaPlugins;

/**
* Instruct an Observable to pass control to another Observable rather than invoking
Expand Down Expand Up @@ -58,6 +59,7 @@ public void onNext(T t) {

@Override
public void onError(Throwable e) {
RxJavaPlugins.getInstance().getErrorHandler().handleError(e);
unsubscribe();
resumeSequence.unsafeSubscribe(child);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
import rx.Subscriber;
import rx.exceptions.CompositeException;
import rx.functions.Func1;
import rx.plugins.RxJavaPlugins;

/**
* Instruct an Observable to emit a particular item to its Observer's <code>onNext</code> method
Expand Down Expand Up @@ -59,6 +60,7 @@ public void onNext(T t) {
@Override
public void onError(Throwable e) {
try {
RxJavaPlugins.getInstance().getErrorHandler().handleError(e);
T result = resultFunction.call(e);

child.onNext(result);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
import rx.Observable;
import rx.Observable.Operator;
import rx.Subscriber;
import rx.plugins.RxJavaPlugins;

/**
* Instruct an Observable to pass control to another Observable rather than invoking
Expand Down Expand Up @@ -63,6 +64,7 @@ public void onNext(T t) {
@Override
public void onError(Throwable e) {
if (e instanceof Exception) {
RxJavaPlugins.getInstance().getErrorHandler().handleError(e);
unsubscribe();
resumeSequence.unsafeSubscribe(child);
} else {
Expand Down