Curl error handling correction