Update index.js

The JSON.parse error is caught with a pseudo appropriate error message.
Merge pull request #16 from trupin/master

Manage the case where a non-JSON format is resturned by the API