Add better exception for wrong getName() usage #512