/** * When the api call results in RestException this method * will be called to return the error message * * @param RestException $exception exception that has reasons for failure * * @return array */ public function message(RestException $exception) { //TODO: check Defaults::language and change result accordingly $r = array('error' => array('code' => $exception->getCode(), 'message' => $exception->getErrorMessage()) + $exception->getDetails()); if (!Scope::get('Restler')->getProductionMode() && self::$includeDebugInfo) { $r += array('debug' => array('source' => $exception->getSource(), 'stages' => $exception->getStages())); } return $r; }