/** * @param string $message * The human friendly error message. * @param array $extraParams * Extra params to return. eg an extra array of ids. It is not mandatory, * but can help the computer using the api. Keep in mind the api consumer * isn't to be trusted. eg. the database password is NOT a good extra data. * @param \Exception|NULL $previous * A previous exception which caused this new exception. */ public function __construct($message, $extraParams = array(), \Exception $previous = NULL) { parent::__construct($message, \API_Exception::NOT_IMPLEMENTED, $extraParams, $previous); }
/** * @param \API_Exception $e * An unhandled exception. * @param array $apiRequest * The full description of the API request. * @return array * (API response) */ public function formatApiException($e, $apiRequest) { $data = $e->getExtraParams(); $data['entity'] = \CRM_Utils_Array::value('entity', $apiRequest); $data['action'] = \CRM_Utils_Array::value('action', $apiRequest); if (\CRM_Utils_Array::value('debug', \CRM_Utils_Array::value('params', $apiRequest)) && empty($data['trace'])) { $data['trace'] = $e->getTraceAsString(); } return $this->createError($e->getMessage(), $data, $apiRequest, $e->getCode()); }
/** * @param string $message * @param array $extraParams * @param Exception $previous */ public function __construct($message, $extraParams = array(), Exception $previous = NULL) { parent::__construct($message, \API_Exception::UNAUTHORIZED, $extraParams, $previous); }