X-Git-Url: https://vcs.fsf.org/?a=blobdiff_plain;f=api%2Fv3%2Fexamples%2FSetting%2FGetDefaults.php;h=5084c159cee6aacd1edf3a98d75819fdc3ffa40a;hb=66c6206c9d19f2aa13ff0f7051c9952b6fbdad50;hp=4b5efa7526f105c08e6676e5d0f15c48638b85bf;hpb=9ec6ee45cba57b5cc659dcb836171e8041104ba0;p=civicrm-core.git diff --git a/api/v3/examples/Setting/GetDefaults.php b/api/v3/examples/Setting/GetDefaults.php index 4b5efa7526..5084c159ce 100644 --- a/api/v3/examples/Setting/GetDefaults.php +++ b/api/v3/examples/Setting/GetDefaults.php @@ -1,20 +1,28 @@ 3, 'name' => 'address_format', ); - $result = civicrm_api( 'setting','getdefaults',$params ); +try{ + $result = civicrm_api3('setting', 'getdefaults', $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_getdefaults_expectedresult(){ @@ -36,7 +44,7 @@ function setting_getdefaults_expectedresult(){ ), ); - return $expectedResult ; + return $expectedResult; }