Check properly for TypeError as well, since that's what's thrown for trying to index an array with a string