discord-jadx/app/src/main/java/j0/n/b.java
2021-07-24 04:37:17 +02:00

82 lines
2.3 KiB
Java

package j0.n;
import c.q.a.k.a;
import j0.o.l;
import j0.o.o;
import java.util.Arrays;
import java.util.Objects;
import rx.Subscriber;
import rx.exceptions.CompositeException;
import rx.exceptions.OnErrorFailedException;
import rx.exceptions.OnErrorNotImplementedException;
import rx.exceptions.UnsubscribeFailedException;
/* compiled from: SafeSubscriber */
public class b<T> extends Subscriber<T> {
public final Subscriber<? super T> i;
public boolean j;
public b(Subscriber<? super T> subscriber) {
super(subscriber);
this.i = subscriber;
}
@Override // j0.g
public void onCompleted() {
if (!this.j) {
this.j = true;
try {
this.i.onCompleted();
try {
unsubscribe();
} catch (Throwable th) {
l.b(th);
throw new UnsubscribeFailedException(th.getMessage(), th);
}
} catch (Throwable th2) {
try {
unsubscribe();
throw th2;
} catch (Throwable th3) {
l.b(th3);
throw new UnsubscribeFailedException(th3.getMessage(), th3);
}
}
}
}
@Override // j0.g
public void onError(Throwable th) {
a.a0(th);
if (!this.j) {
this.j = true;
Objects.requireNonNull(o.a.b());
try {
this.i.onError(th);
try {
unsubscribe();
} catch (Throwable th2) {
l.b(th2);
throw new OnErrorFailedException(th2);
}
} catch (OnErrorNotImplementedException e) {
unsubscribe();
throw e;
} catch (Throwable th3) {
l.b(th3);
throw new OnErrorNotImplementedException("Observer.onError not implemented and error while unsubscribing.", new CompositeException(Arrays.asList(th, th3)));
}
}
}
@Override // j0.g
public void onNext(T t) {
try {
if (!this.j) {
this.i.onNext(t);
}
} catch (Throwable th) {
a.a0(th);
onError(th);
}
}
}