throwing exceptions on cURL errors