/** * @param string $errorString A string in the format: "ERR_CODE;PARAMS;MSG_STRING" * @throws Exception */ function KalturaAPIException($errorString) { $errorArgs = func_get_args(); array_shift($errorArgs); $errorData = APIErrors::getErrorData($errorString, $errorArgs); $this->message = $errorData['message']; $this->code = $errorData['code']; $this->args = $errorData['args']; }
private function dieOnError($error_code) { if (is_array($error_code)) { $args = $error_code; $error_code = $error_code[0]; } else { $args = func_get_args(); } array_shift($args); $errorData = APIErrors::getErrorData($error_code, $args); $error_code = $errorData['code']; $formated_desc = $errorData['message']; header("X-Kaltura:error-{$error_code}"); header('X-Kaltura-App: exiting on error ' . $error_code . ' - ' . $formated_desc); die; }
public function __construct($errorString) { $errorArgs = func_get_args(); array_shift($errorArgs); $errorData = APIErrors::getErrorData($errorString, $errorArgs); $this->code = $errorData['code']; $this->args = $errorData['args']; $this->message = @call_user_func_array('sprintf', array_merge(array($errorData['message']), $errorArgs)); }
protected function addError($error_code) { if (is_array($error_code)) { $args = $error_code; $error_code = $error_code[0]; } else { $args = func_get_args(); } array_shift($args); $errorData = APIErrors::getErrorData($error_code, $args); $this->error[] = array("code" => $errorData['code'], "desc" => $errorData['message']); }
<table> <tr> <th>Error Code</th> <th>Error message</th> </tr> <?php $odd = true; foreach ($generalError as $error => $errorParams) { ?> <tr class="<?php echo $odd ? "odd" : ""; ?> "> <?php $errorData = APIErrors::getErrorData($error, $errorParams); ?> <td><?php echo $errorData['code']; ?> </td> <td><?php echo $errorData['message']; ?> </td> </tr> <?php $odd = !$odd; } ?> </table>