75 lines
2.4 KiB
Java
75 lines
2.4 KiB
Java
|
package retrofit2.adapter.rxjava3;
|
||
|
|
||
|
import io.reactivex.rxjava3.exceptions.CompositeException;
|
||
|
import o.AbstractC13163fSk;
|
||
|
import o.C13147fSI;
|
||
|
import o.C13418fZu;
|
||
|
import o.InterfaceC13174fSv;
|
||
|
import o.fSJ;
|
||
|
import retrofit2.Response;
|
||
|
|
||
|
/* loaded from: classes.dex */
|
||
|
final class BodyObservable<T> extends AbstractC13163fSk<T> {
|
||
|
private final AbstractC13163fSk<Response<T>> upstream;
|
||
|
|
||
|
/* JADX INFO: Access modifiers changed from: package-private */
|
||
|
public BodyObservable(AbstractC13163fSk<Response<T>> abstractC13163fSk) {
|
||
|
this.upstream = abstractC13163fSk;
|
||
|
}
|
||
|
|
||
|
@Override // o.AbstractC13163fSk
|
||
|
public final void subscribeActual(InterfaceC13174fSv<? super T> interfaceC13174fSv) {
|
||
|
this.upstream.subscribe(new BodyObserver(interfaceC13174fSv));
|
||
|
}
|
||
|
|
||
|
/* loaded from: classes6.dex */
|
||
|
static class BodyObserver<R> implements InterfaceC13174fSv<Response<R>> {
|
||
|
private final InterfaceC13174fSv<? super R> observer;
|
||
|
private boolean terminated;
|
||
|
|
||
|
BodyObserver(InterfaceC13174fSv<? super R> interfaceC13174fSv) {
|
||
|
this.observer = interfaceC13174fSv;
|
||
|
}
|
||
|
|
||
|
@Override // o.InterfaceC13174fSv
|
||
|
public void onSubscribe(fSJ fsj) {
|
||
|
this.observer.onSubscribe(fsj);
|
||
|
}
|
||
|
|
||
|
@Override // o.InterfaceC13174fSv
|
||
|
public void onNext(Response<R> response) {
|
||
|
if (response.isSuccessful()) {
|
||
|
this.observer.onNext(response.body());
|
||
|
return;
|
||
|
}
|
||
|
this.terminated = true;
|
||
|
HttpException httpException = new HttpException(response);
|
||
|
try {
|
||
|
this.observer.onError(httpException);
|
||
|
} catch (Throwable th) {
|
||
|
C13147fSI.c(th);
|
||
|
C13418fZu.c(new CompositeException(httpException, th));
|
||
|
}
|
||
|
}
|
||
|
|
||
|
@Override // o.InterfaceC13174fSv
|
||
|
public void onComplete() {
|
||
|
if (this.terminated) {
|
||
|
return;
|
||
|
}
|
||
|
this.observer.onComplete();
|
||
|
}
|
||
|
|
||
|
@Override // o.InterfaceC13174fSv
|
||
|
public void onError(Throwable th) {
|
||
|
if (!this.terminated) {
|
||
|
this.observer.onError(th);
|
||
|
return;
|
||
|
}
|
||
|
AssertionError assertionError = new AssertionError("This should never happen! Report as a bug with the full stacktrace.");
|
||
|
assertionError.initCause(th);
|
||
|
C13418fZu.c(assertionError);
|
||
|
}
|
||
|
}
|
||
|
}
|