️ improve exception handling and API response

This commit is contained in:
Marc Michalsky forumZFD 2021-04-12 10:29:52 +02:00
parent ab8c16fac2
commit 060f7ec2dc
Signed by untrusted user who does not match committer: marc.koch
GPG key ID: 12406554CFB028B9
2 changed files with 38 additions and 12 deletions

View file

@ -405,6 +405,9 @@ class CRM_TwingleCampaign_BAO_TwingleApiCall {
} elseif ($curl_status_code == 500) {
throw new Exception('https status code 500 (internal error)');
}
if (sizeof($response) == 1 && isset($response['message'])){
throw new Exception($response['message']);
}
return $response;
}