package com.fyber.inneractive.sdk.flow; import com.fyber.inneractive.sdk.external.InneractiveAdRequest; import com.fyber.inneractive.sdk.external.InneractiveErrorCode; import com.fyber.inneractive.sdk.external.InneractiveInfrastructureError; import com.fyber.inneractive.sdk.network.s; import com.fyber.inneractive.sdk.util.IAlog; import java.util.Arrays; import org.json.JSONArray; import org.json.JSONObject; /* loaded from: classes2.dex */ public final class a { public static void a(InneractiveAdRequest inneractiveAdRequest, InneractiveInfrastructureError inneractiveInfrastructureError, q qVar, com.fyber.inneractive.sdk.response.e eVar, JSONArray jSONArray) { String sb; if (inneractiveInfrastructureError.getErrorCode().getMetricable() == InneractiveErrorCode.Metricable.INCLUDED_IN_FAILED_METRICS) { if ((qVar == null || qVar.e() || qVar.isVideoAd()) && !inneractiveInfrastructureError.isErrorAlreadyReported(com.fyber.inneractive.sdk.network.q.IA_AD_LOAD_FAILED)) { IAlog.a("Firing Event 801 - AdLoadFailed - errorCode - %s", inneractiveInfrastructureError.getErrorCode()); if (inneractiveInfrastructureError.getCause() != null) { sb = Arrays.toString(inneractiveInfrastructureError.getCause().getStackTrace()); } else { StringBuilder sb2 = new StringBuilder(); StackTraceElement[] stackTrace = Thread.currentThread().getStackTrace(); for (int i = 7; i >= 0 && i < 13 && i < stackTrace.length; i++) { sb2.append(stackTrace[i].toString()); sb2.append(","); } sb = sb2.toString(); } com.fyber.inneractive.sdk.network.q qVar2 = com.fyber.inneractive.sdk.network.q.IA_AD_LOAD_FAILED; s.a aVar = new s.a(qVar2, inneractiveAdRequest, eVar, jSONArray); JSONObject jSONObject = new JSONObject(); String obj = inneractiveInfrastructureError.getFyberMarketplaceAdLoadFailureReason().toString(); try { jSONObject.put("message", obj); } catch (Exception unused) { IAlog.f("Got exception adding param to json object: %s, %s", "message", obj); } try { jSONObject.put("description", sb); } catch (Exception unused2) { IAlog.f("Got exception adding param to json object: %s, %s", "description", sb); } String description = inneractiveInfrastructureError.description(); try { jSONObject.put("extra_description", description); } catch (Exception unused3) { IAlog.f("Got exception adding param to json object: %s, %s", "extra_description", description); } aVar.f.put(jSONObject); aVar.a((String) null); inneractiveInfrastructureError.addReportedError(qVar2); } } } }