Skip to content
Snippets Groups Projects
Commit 7a514fb1 authored by xurizaemon's avatar xurizaemon
Browse files

Return a CiviCRM-looking error if we hit a cURL error.

Handle cURL errors by synthesising a CiviCRM error object.

This is API so we can't depend on having CRM_Core_Error::createError() available.
parent 557f8788
No related branches found
No related tags found
No related merge requests found
......@@ -140,6 +140,13 @@ class civicrm_api3 {
//execute post
$result = curl_exec($ch);
// CiviCRM expects to get back a CiviCRM error object.
if (curl_errno($ch)) {
$res = new stdClass;
$res->is_error = 1;
$res->error = array('cURL error' => curl_error($ch));
return $res;
}
curl_close($ch);
return json_decode($result);
// not good, all in get when should be in post.
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment