catch TypeError when trying to locate error