X-Git-Url: https://vcs.fsf.org/?a=blobdiff_plain;f=api%2Fv3%2Fexamples%2FSetting%2FCreateAllDomains.php;h=8e1cc71ffa5d7c53f055cef142587f59641b2c89;hb=e9892356ef3d00173773eafbc981e1efa0982f31;hp=78351d2ded956f439be38f009f1fa31b4fa8fea3;hpb=52910807c090423707113d77d4e38ef1d606ad6a;p=civicrm-core.git diff --git a/api/v3/examples/Setting/CreateAllDomains.php b/api/v3/examples/Setting/CreateAllDomains.php index 78351d2ded..8e1cc71ffa 100644 --- a/api/v3/examples/Setting/CreateAllDomains.php +++ b/api/v3/examples/Setting/CreateAllDomains.php @@ -1,21 +1,29 @@ 3, 'domain_id' => 'all', 'uniq_email_per_site' => 1, ); - $result = civicrm_api( 'setting','create',$params ); +try{ + $result = civicrm_api3('setting', 'create', $params); +} +catch (CiviCRM_API3_Exception $e) { + // handle error here + $errorMessage = $e->getMessage(); + $errorCode = $e->getErrorCode(); + $errorData = $e->getExtraParams(); + return array('error' => $errorMessage, 'error_code' => $errorCode, 'error_data' => $errorData); +} - return $result; +return $result; } -/* +/** * Function returns array of result expected from previous function */ function setting_create_expectedresult(){ @@ -37,7 +45,7 @@ function setting_create_expectedresult(){ ), ); - return $expectedResult ; + return $expectedResult; } @@ -61,4 +69,4 @@ function setting_create_expectedresult(){ * * API Standards documentation: * http://wiki.civicrm.org/confluence/display/CRM/API+Architecture+Standards -*/ \ No newline at end of file +*/