package com.ea.nimble; import android.os.Build; import android.os.Parcel; import android.os.Parcelable; import java.io.Externalizable; import java.io.IOException; import java.io.ObjectInput; import java.io.ObjectOutput; import java.io.PrintWriter; import java.io.StringWriter; /* loaded from: classes2.dex */ public class Error extends Exception implements Parcelable, Externalizable { public static final Parcelable.Creator CREATOR = new Parcelable.Creator() { // from class: com.ea.nimble.Error.1 /* JADX WARN: Can't rename method to resolve collision */ @Override // android.os.Parcelable.Creator public Error createFromParcel(Parcel parcel) { return new Error(parcel); } /* JADX WARN: Can't rename method to resolve collision */ @Override // android.os.Parcelable.Creator public Error[] newArray(int i) { return new Error[i]; } }; public static final String ERROR_DOMAIN = "NimbleError"; private static final long serialVersionUID = 1; private int m_code; private String m_domain; @Override // android.os.Parcelable public int describeContents() { return 0; } public int getCode() { return this.m_code; } public String getDomain() { return this.m_domain; } public enum Code { UNKNOWN(0), SYSTEM_UNEXPECTED(100), NOT_READY(101), UNSUPPORTED(102), NOT_AVAILABLE(103), NOT_IMPLEMENTED(104), INVALID_ARGUMENT(300), MISSING_CALLBACK(301), NETWORK_UNSUPPORTED_CONNECTION_TYPE(1001), NETWORK_NO_CONNECTION(1002), NETWORK_UNREACHABLE(1003), NETWORK_OVERSIZE_DATA(1004), NETWORK_OPERATION_CANCELLED(1005), NETWORK_INVALID_SERVER_RESPONSE(1006), NETWORK_TIMEOUT(1007), NETWORK_CONNECTION_ERROR(1010), SYNERGY_SERVER_FULL(2001), SYNERGY_GET_DIRECTION_TIMEOUT(2002), SYNERGY_GET_EA_DEVICE_ID_FAILURE(2003), SYNERGY_VALIDATE_EA_DEVICE_ID_FAILURE(2004), SYNERGY_GET_ANONYMOUS_ID_FAILURE(2005), SYNERGY_ENVIRONMENT_UPDATE_FAILURE(2006), SYNERGY_PURCHASE_VERIFICATION_FAILURE(2007), SYNERGY_GET_NONCE_FAILURE(2008), SYNERGY_GET_AGE_COMPLIANCE_FAILURE(2009); private final int m_value; public int intValue() { return this.m_value; } Code(int i) { this.m_value = i; } } public Error(String str, int i, String str2, Throwable th) { super(str2, th); this.m_domain = str; this.m_code = i; } public Error(String str, int i, String str2) { this(str, i, str2, null); } public Error(Code code, String str, Throwable th) { this(ERROR_DOMAIN, code.intValue(), str, th); } public Error(Code code, String str) { this(code, str, (Throwable) null); } public Error() { } public boolean isError(Code code) { return this.m_code == code.intValue(); } @Override // java.lang.Throwable public String toString() { StringBuilder sb = new StringBuilder(); String str = this.m_domain; if (str != null && str.length() > 0) { sb.append(this.m_domain); sb.append("("); } else { sb.append("Error"); sb.append("("); } sb.append(this.m_code); sb.append(")"); String localizedMessage = getLocalizedMessage(); if (localizedMessage != null && localizedMessage.length() > 0) { sb.append(": "); sb.append(localizedMessage); } Throwable cause = getCause(); if (cause != null) { sb.append("\nCaused by: "); StringWriter stringWriter = new StringWriter(); cause.printStackTrace(new PrintWriter(stringWriter)); sb.append(stringWriter); } else { sb.append("\nCaused by: null"); } return sb.toString(); } public Error(Parcel parcel) { readFromParcel(parcel); } @Override // android.os.Parcelable public void writeToParcel(Parcel parcel, int i) { String str = this.m_domain; if (str != null && str.length() > 0) { parcel.writeString(this.m_domain); } else { parcel.writeString(""); } parcel.writeInt(this.m_code); Throwable cause = getCause(); if (cause != null) { parcel.writeSerializable(cause); } else { parcel.writeSerializable(""); } } public void readFromParcel(Parcel parcel) { Throwable th; Object readSerializable; this.m_domain = parcel.readString(); this.m_code = parcel.readInt(); if (Build.VERSION.SDK_INT >= 33) { readSerializable = parcel.readSerializable(null, Throwable.class); th = (Throwable) readSerializable; } else { th = (Throwable) parcel.readSerializable(); } initCause(th); } @Override // java.io.Externalizable public void readExternal(ObjectInput objectInput) throws IOException, ClassNotFoundException { this.m_domain = objectInput.readUTF(); this.m_code = objectInput.readInt(); initCause((Throwable) objectInput.readObject()); } @Override // java.io.Externalizable public void writeExternal(ObjectOutput objectOutput) throws IOException { String str = this.m_domain; if (str != null && str.length() > 0) { objectOutput.writeUTF(this.m_domain); } else { objectOutput.writeUTF(""); } objectOutput.writeInt(this.m_code); objectOutput.writeObject(getCause()); } }