what-the-bank/sources/com/scb/phone/domain/errors/RetrofitException.java

185 lines
5.8 KiB
Java

package com.scb.phone.domain.errors;
import io.beid.beidk.definitions.SCBHeader;
import java.io.IOException;
import java.lang.annotation.Annotation;
import o.C5136bnO;
import o.JsH;
import o.QLa;
import o.VCl;
import o.ggV;
import o.guQ;
import okhttp3.Request;
import okhttp3.Response;
import retrofit2.Retrofit;
/* loaded from: classes.dex */
public class RetrofitException extends IOException {
private static Response b;
private static Request c;
public final C5136bnO a;
public final RVV d;
public final VCl e;
/* loaded from: classes.dex */
public enum RVV {
NETWORK,
HTTP,
UNEXPECTED,
TIME_OUT,
API_ERROR,
SESSION_EXPIRED,
TRANSACTION_TOKEN_INVALID,
OTP_FAILED,
OTP_REACH_MAX_LIMIT,
OTP_EXPIRED,
REQUIRED_OTP,
NON_FASTPAY,
APP_OUTDATED,
COMMON_ERROR,
SERVER_ERROR
}
public static RetrofitException c(retrofit2.Response response, Retrofit retrofit) {
C5136bnO b2 = b("http_");
StringBuilder sb = new StringBuilder();
sb.append(response.code());
sb.append(" ");
sb.append(response.message());
String obj = sb.toString();
try {
return new RetrofitException(obj, (VCl) retrofit.responseBodyConverter(VCl.class, new Annotation[0]).convert(response.errorBody()), RVV.HTTP, null, b2);
} catch (IOException e) {
guQ.c(e, "API returns an invalid httpError", new Object[0]);
return new RetrofitException(obj, null, RVV.UNEXPECTED, null, b2);
}
}
public static RetrofitException b(retrofit2.Response response, Retrofit retrofit) {
C5136bnO b2 = b("http_");
StringBuilder sb = new StringBuilder();
sb.append(response.code());
sb.append(" ");
sb.append(response.message());
String obj = sb.toString();
try {
return new RetrofitException(obj, (VCl) retrofit.responseBodyConverter(VCl.class, new Annotation[0]).convert(response.errorBody()), RVV.SERVER_ERROR, null, b2);
} catch (IOException e) {
guQ.c(e, "API returns an invalid httpError", new Object[0]);
return new RetrofitException(obj, null, RVV.UNEXPECTED, null, b2);
}
}
private static C5136bnO b(String str) {
int i;
if (c != null) {
if (b != null) {
if ("http_".equalsIgnoreCase(str)) {
StringBuilder sb = new StringBuilder("http_");
sb.append(b.code());
str = sb.toString();
}
i = b.code();
} else {
i = -1;
}
C5136bnO c5136bnO = new C5136bnO(str, c.header(SCBHeader.SCB_REQ_HEADER_REQUEST_ID), c.url().uri().getPath(), i);
if (!"generic".equals(str) || b != null) {
c = null;
b = null;
}
return c5136bnO;
}
return new C5136bnO();
}
public static RetrofitException a(IOException iOException) {
return new RetrofitException(iOException.getMessage(), null, RVV.TIME_OUT, iOException, b("timeout"));
}
public static RetrofitException c(IOException iOException) {
return new RetrofitException(iOException.getMessage(), null, RVV.NETWORK, iOException, b("no_internet"));
}
public static RetrofitException a(Throwable th) {
return new RetrofitException(th.getMessage(), null, RVV.UNEXPECTED, th, b("generic"));
}
public static RetrofitException b(Throwable th) {
return new RetrofitException(th.getMessage(), null, RVV.UNEXPECTED, th, b("json_parsing"));
}
public static RetrofitException c(VCl vCl) {
return new RetrofitException(null, vCl, RVV.API_ERROR, null, b("generic"));
}
public static RetrofitException f(VCl vCl) {
return new RetrofitException(null, vCl, RVV.SESSION_EXPIRED, null, b("generic"));
}
public static RetrofitException h(VCl vCl) {
return new RetrofitException(null, vCl, RVV.TRANSACTION_TOKEN_INVALID, null, b("generic"));
}
public static RetrofitException g(VCl vCl) {
return new RetrofitException(null, vCl, RVV.REQUIRED_OTP, null, b("generic"));
}
public static RetrofitException i(VCl vCl) {
return new RetrofitException(null, vCl, RVV.OTP_FAILED, null, b("generic"));
}
public static RetrofitException a(VCl vCl) {
return new RetrofitException(null, vCl, RVV.OTP_EXPIRED, null, b("generic"));
}
public static RetrofitException j(VCl vCl) {
return new RetrofitException(null, vCl, RVV.OTP_REACH_MAX_LIMIT, null, b("generic"));
}
public static RetrofitException b(VCl vCl) {
return new RetrofitException(null, vCl, RVV.NON_FASTPAY, null, b("generic"));
}
public static RetrofitException e(VCl vCl) {
return new RetrofitException(null, vCl, RVV.APP_OUTDATED, null, b("generic"));
}
public static RetrofitException d(VCl vCl) {
return new RetrofitException(null, vCl, RVV.COMMON_ERROR, null, b("generic"));
}
public static RetrofitException c(JsH jsH) {
C5136bnO b2 = b("generic");
QLa qLa = jsH.b;
ggV d = ggV.d();
d.e = qLa.c;
d.d = qLa.b;
d.c = qLa.a;
VCl b3 = VCl.b();
b3.c = d;
return new FacialValidationException(jsH, b3, b2);
}
/* JADX INFO: Access modifiers changed from: package-private */
public RetrofitException(String str, VCl vCl, RVV rvv, Throwable th, C5136bnO c5136bnO) {
super(str, th);
this.e = vCl;
this.d = rvv;
this.a = c5136bnO;
}
public static void c(Response response) {
b = response;
}
public static void d(Request request) {
c = request;
}
public static void a() {
c = null;
b = null;
}
}