Trying to make blizz raid frames use class color names

hooksecurefunc("CompactUnitFrame_UpdateAll", function(frame)
    if frame.unit and frame.unit:find("party") or frame.unit:find("raid") then
        local name = frame.name
        if name then
            local _, class = UnitClass(frame.unit)
            if class then
                local color = RAID_CLASS_COLORS[class]
                name:SetTextColor(color.r, color.g, color.b)
            end
        end
    end
end)

this seems to be throwing errors though. any idea? I’m on classic cata, if that matters.

What is the error?