catch TypeError in API
TODO: generalise for all API methods
Merge pull request #381 from JahPowerBit/develop3

catch TypeError in API