X-Git-Url: https://vcs.fsf.org/?a=blobdiff_plain;f=api%2Fv3%2Fexamples%2FOptionValueGet.php;h=5490d6c3b912ec900de356a5ed93bfdbdbe0fdfa;hb=b259a4ab1e349db53f15beb4c1e9808b58dba765;hp=dbce441a53da0f8b605dc8f6c792c69b779b9468;hpb=e4d8474f2d6b1252d1806ba2f656cd7a60a92b4d;p=civicrm-core.git diff --git a/api/v3/examples/OptionValueGet.php b/api/v3/examples/OptionValueGet.php index dbce441a53..5490d6c3b9 100644 --- a/api/v3/examples/OptionValueGet.php +++ b/api/v3/examples/OptionValueGet.php @@ -1,20 +1,28 @@ 1, - 'version' => 3, ); - $result = civicrm_api( 'option_value','get',$params ); +try{ + $result = civicrm_api3('option_value', '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 option_value_get_expectedresult(){ @@ -82,7 +90,7 @@ function option_value_get_expectedresult(){ ), ); - return $expectedResult ; + return $expectedResult; } @@ -106,4 +114,4 @@ function option_value_get_expectedresult(){ * * API Standards documentation: * http://wiki.civicrm.org/confluence/display/CRM/API+Architecture+Standards -*/ \ No newline at end of file +*/