package g.a;

import f.l;
import java.util.Iterator;
import java.util.List;

/* JADX INFO: compiled from: CoroutineExceptionHandlerImpl.kt */
/* JADX INFO: loaded from: classes.dex */
public final class d0 {
    private static final List<c0> a = f.d0.h.e(f.d0.f.a(defpackage.a.a()));

    public static final void a(f.w.g gVar, Throwable th) {
        Iterator<c0> it = a.iterator();
        while (it.hasNext()) {
            try {
                it.next().handleException(gVar, th);
            } catch (Throwable th2) {
                Thread threadCurrentThread = Thread.currentThread();
                threadCurrentThread.getUncaughtExceptionHandler().uncaughtException(threadCurrentThread, e0.b(th, th2));
            }
        }
        Thread threadCurrentThread2 = Thread.currentThread();
        try {
            l.a aVar = f.l.f3940b;
            f.b.a(th, new t0(gVar));
            f.l.a(f.t.a);
        } catch (Throwable th3) {
            l.a aVar2 = f.l.f3940b;
            f.l.a(f.m.a(th3));
        }
        threadCurrentThread2.getUncaughtExceptionHandler().uncaughtException(threadCurrentThread2, th);
    }
}
