package com.google.android.gms.fido.u2f.api.common;

import defpackage.n41;
import defpackage.sma;
import defpackage.vo6;
import java.util.Locale;
import org.json.JSONException;
import org.json.JSONObject;

/* JADX INFO: loaded from: classes2.dex */
@Deprecated
public class Error {

    @sma
    @vo6
    public static final String JSON_ERROR_CODE = "errorCode";

    @sma
    @vo6
    public static final String JSON_ERROR_MESSAGE = "errorMessage";
    private final ErrorCode zza;
    private final String zzb;

    public Error(@vo6 ErrorCode errorCode) {
        this.zza = errorCode;
        this.zzb = null;
    }

    @vo6
    public ErrorCode getErrorCode() {
        return this.zza;
    }

    @vo6
    public String getErrorMessage() {
        return this.zzb;
    }

    @vo6
    public JSONObject toJsonObject() {
        JSONObject jSONObject = new JSONObject();
        try {
            jSONObject.put("errorCode", this.zza.getCode());
            String str = this.zzb;
            if (str == null) {
                return jSONObject;
            }
            jSONObject.put("errorMessage", str);
            return jSONObject;
        } catch (JSONException e) {
            throw new RuntimeException(e);
        }
    }

    @vo6
    public String toString() {
        if (this.zzb == null) {
            Locale locale = Locale.ENGLISH;
            return n41.i(this.zza.getCode(), "{errorCode: ", "}");
        }
        ErrorCode errorCode = this.zza;
        Locale locale2 = Locale.ENGLISH;
        return "{errorCode: " + errorCode.getCode() + ", errorMessage: " + this.zzb + "}";
    }

    public Error(@vo6 ErrorCode errorCode, @vo6 String str) {
        this.zza = errorCode;
        this.zzb = str;
    }
}
