Adding Error Handling to new code

This should stop errors being spewed into console and return any HTTP errors contacting API.

Errors should be self explanatory.