what-the-bank/sources/retrofit2/adapter/rxjava3/ResultObservable.java

64 lines
2.0 KiB
Java
Raw Permalink Normal View History

2024-07-27 18:17:47 +07:00
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 ResultObservable<T> extends AbstractC13163fSk<Result<T>> {
private final AbstractC13163fSk<Response<T>> upstream;
/* JADX INFO: Access modifiers changed from: package-private */
public ResultObservable(AbstractC13163fSk<Response<T>> abstractC13163fSk) {
this.upstream = abstractC13163fSk;
}
@Override // o.AbstractC13163fSk
public final void subscribeActual(InterfaceC13174fSv<? super Result<T>> interfaceC13174fSv) {
this.upstream.subscribe(new ResultObserver(interfaceC13174fSv));
}
/* loaded from: classes6.dex */
static class ResultObserver<R> implements InterfaceC13174fSv<Response<R>> {
private final InterfaceC13174fSv<? super Result<R>> observer;
ResultObserver(InterfaceC13174fSv<? super Result<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) {
this.observer.onNext(Result.response(response));
}
@Override // o.InterfaceC13174fSv
public void onError(Throwable th) {
try {
this.observer.onNext(Result.error(th));
this.observer.onComplete();
} catch (Throwable th2) {
try {
this.observer.onError(th2);
} catch (Throwable th3) {
C13147fSI.c(th3);
C13418fZu.c(new CompositeException(th2, th3));
}
}
}
@Override // o.InterfaceC13174fSv
public void onComplete() {
this.observer.onComplete();
}
}
}