Added errorhandling for cURL

Now triggers an error if something goes wrong with the cURL request.