✨️ improve exception handling and API response
This commit is contained in:
parent
ab8c16fac2
commit
060f7ec2dc
2 changed files with 38 additions and 12 deletions
|
@ -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;
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue