Exemple #1
0
 /**
  * Return a textual error message for a NModel error code
  *
  * @param integer error code
  *
  * @return string error message, or false if the error code was
  * not recognized
  */
 function errorMessage($value)
 {
     static $errorMessages;
     if (!isset($errorMessages)) {
         $errorMessages = array(N_DAO_ERROR => 'unknown error', N_DAO_OBJECT_NOT_FOUND => 'the object could not be found', N_DAO_OBJECT_EXISTS => 'an object by that name already exists', N_DAO_FILE_NOT_FOUND => 'the file could not be found', N_DAO_CLASS_NOT_FOUND => 'the class could not be found', N_DAO_CLASS_ERROR => 'unkown class error', N_DAO_RECORD_EXISTS => 'an info object by that name already exists', N_DAO_RECORD_NOT_FOUND => 'the class record could not be found');
     }
     if (NModel::isError($value)) {
         $value = $value->getCode();
     }
     return isset($errorMessages[$value]) ? $errorMessages[$value] : $errorMessages[IO_ERROR];
 }