X-Git-Url: https://vcs.fsf.org/?a=blobdiff_plain;f=api%2Fv3%2Fexamples%2FSetting%2FGetSpecifiedDomains.php;h=f839e0934cddb963dcefa254dbda829c802b0145;hb=c156d4d6f1d69cfb9e578901f485b67e39f70cf3;hp=9389205ee04cc38bd59f255a04e4af33151bbc42;hpb=ab28144e2f83e8ab33a4d6d60cd5e6dd3d9184eb;p=civicrm-core.git diff --git a/api/v3/examples/Setting/GetSpecifiedDomains.php b/api/v3/examples/Setting/GetSpecifiedDomains.php index 9389205ee0..f839e0934c 100644 --- a/api/v3/examples/Setting/GetSpecifiedDomains.php +++ b/api/v3/examples/Setting/GetSpecifiedDomains.php @@ -1,11 +1,10 @@ 3, 'domain_id' => array( '0' => 1, '1' => 2, @@ -15,12 +14,21 @@ $params = array( ), ); - $result = civicrm_api( 'setting','Get',$params ); +try{ + $result = civicrm_api3('setting', 'Get', $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_get_expectedresult(){ @@ -39,7 +47,7 @@ function setting_get_expectedresult(){ ), ); - return $expectedResult ; + return $expectedResult; }