Added error-handling for cURL

Now triggers error if the cURL request fails.