package tp;

/* loaded from: classes3.dex */
public abstract class k0 {
    public static final void a(vm.g gVar, Throwable th2) {
        try {
            j0 j0Var = (j0) gVar.d(j0.f36558i);
            if (j0Var != null) {
                j0Var.j(gVar, th2);
            } else {
                zp.h.a(gVar, th2);
            }
        } catch (Throwable th3) {
            zp.h.a(gVar, b(th2, th3));
        }
    }

    public static final Throwable b(Throwable th2, Throwable th3) {
        if (th2 == th3) {
            return th2;
        }
        RuntimeException runtimeException = new RuntimeException("Exception while trying to handle coroutine exception", th3);
        rm.h.a(runtimeException, th2);
        return runtimeException;
    }
}
