fix error message for TwingleForm.Get
This commit is contained in:
parent
5df73c7c26
commit
aadb4246f5
1 changed files with 3 additions and 4 deletions
|
@ -55,6 +55,7 @@ function _civicrm_api3_twingle_form_Get_spec(array &$spec) {
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
function civicrm_api3_twingle_form_Get(array $params): array {
|
function civicrm_api3_twingle_form_Get(array $params): array {
|
||||||
|
$returnValues = [];
|
||||||
|
|
||||||
// Get custom fields
|
// Get custom fields
|
||||||
$custom_field_mapping = Cache::getInstance()->getCustomFieldMapping();
|
$custom_field_mapping = Cache::getInstance()->getCustomFieldMapping();
|
||||||
|
@ -78,7 +79,6 @@ function civicrm_api3_twingle_form_Get(array $params): array {
|
||||||
$result = civicrm_api3('Campaign', 'get', $request);
|
$result = civicrm_api3('Campaign', 'get', $request);
|
||||||
|
|
||||||
if ($result['is_error'] == 0) {
|
if ($result['is_error'] == 0) {
|
||||||
$returnValues = [];
|
|
||||||
foreach($result['values'] as $value) {
|
foreach($result['values'] as $value) {
|
||||||
array_push(
|
array_push(
|
||||||
$returnValues,
|
$returnValues,
|
||||||
|
@ -96,10 +96,9 @@ function civicrm_api3_twingle_form_Get(array $params): array {
|
||||||
return civicrm_api3_create_success($returnValues, $params, 'TwingleForm', 'Get');
|
return civicrm_api3_create_success($returnValues, $params, 'TwingleForm', 'Get');
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
// TODO: Edit error message
|
return civicrm_api3_create_error($result['message']);
|
||||||
throw new API_Exception(/*error_message*/ 'Everyone knows that the magicword is "sesame"', /*error_code*/ 'magicword_incorrect');
|
|
||||||
}
|
}
|
||||||
} catch (Exception $e) {
|
} catch (Exception $e) {
|
||||||
throw new API_Exception(/*error_message*/ 'Everyone knows that the magicword is "sesame"', /*error_code*/ 'magicword_incorrect');
|
throw new API_Exception($e->getMessage());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue