Returns an informative upload error message.

@param int $code

@return string
7720
public function getErrorMessage($code = null)
    {
        $code = $code ?: $this->$code;

        static $errors = [
            UPLOAD_ERR_INI_SIZE => 'The file "%s" exceeds your upload_max_filesize ini directive (limit is %d kb).',
            UPLOAD_ERR_FORM_SIZE => 'The file "%s" exceeds the upload limit defined in your form.',
            UPLOAD_ERR_PARTIAL => 'The file "%s" was only partially uploaded.',
            UPLOAD_ERR_NO_FILE => 'No file was uploaded.',
            UPLOAD_ERR_CANT_WRITE => 'The file "%s" could not be written on disk.',
            UPLOAD_ERR_NO_TMP_DIR => 'File could not be uploaded: missing temporary directory.',
            UPLOAD_ERR_EXTENSION => 'File upload was stopped by a php extension.',
        ];

        $max_file_size = $code === UPLOAD_ERR_INI_SIZE ? self::getMaxFilesize() / 1024 : 0;
        $message = isset($errors[$code]) ? $errors[$code] : 'The file "%s" was not uploaded due to an unknown error.';

        return sprintf($message, $this->getClientOriginalName(), $max_file_size);
    }
18954
public static function getStatusMessage($code) {
    if (array_key_exists($code, self::$status_messages)) {
      return self::$status_messages[$code];
    }
    return sprintf("Unknown Code %d", $code);
  }
1154270
public function get_error_message()
    {
        if ($this->is_valid()) {
            return null;
        }

        static $errors = [
            UPLOAD_ERR_INI_SIZE => 'The file "%s" exceeds the maximum upload size (limit is %s).',
            UPLOAD_ERR_FORM_SIZE => 'The file "%s" exceeds the upload limit defined in your form.',
            UPLOAD_ERR_PARTIAL => 'The file "%s" was only partially uploaded.',
            UPLOAD_ERR_NO_FILE => 'No file was uploaded.',
            UPLOAD_ERR_CANT_WRITE => 'The file "%s" could not be written on disk.',
            UPLOAD_ERR_NO_TMP_DIR => 'File could not be uploaded: missing temporary directory.',
            UPLOAD_ERR_EXTENSION => 'File upload was stopped by a PHP extension.',
        ];

        $message = 'The file "%s" was not uploaded due to an unknown error.';

        if (isset($errors[ $this->data['error'] ])) {
            $message = $errors[ $this->data['error'] ];
        }

        return \sprintf($message, $this->client_name, \size_format(\wp_max_upload_size()));
    }
1018323
public function dontSeeResponseCodeIs($code)
    {
        $failureMessage = sprintf(
            'Expected HTTP status code other than %s',
            HttpCode::getDescription($code)
        );
        $this->assertNotEquals($code, $this->getResponseStatusCode(), $failureMessage);
    }
802749
protected function buildErrorResponse($error, $code = null)
    {
        if ($code !== null && (!is_int($code) || $code < 400)) {
            $code = null;
        }
        if (is_object($error)) {
            if ($error instanceof AccessDeniedException) {
                $error = $error->getMessage();
                if ($code === null) {
                    $code = Response::HTTP_UNAUTHORIZED;
                }
            } elseif ($error instanceof UserMessageException) {
                if ($error->getCode() >= 400) {
                    $code = $error->getCode();
                }
                $error = $error->getMessage();
            } elseif ($error instanceof Exception || $error instanceof Throwable) {
                $error = t('An unexpected error occurred');
            } elseif (is_callable([$error, '__toString'])) {
                $error = (string) $error;
            } else {
                $error = get_class($error);
            }
        }
        if ($code === null) {
            $code = Response::HTTP_INTERNAL_SERVER_ERROR;
        }

        return $this->getResponseFactory()->create(
            $error,
            $code,
            [
                'Content-Type' => 'text/plain; charset=UTF-8',
            ]
        );
    }
1173248
public function returnError(int $code)
    {
        if (isset($this->errors[$code])) {
            self::response()->setStatus($code);

            return $this->callController($this->errors[$code], []);
        } else {
            return '<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN">' . "\n" .
                '<html><head>' . "\n" .
                '<title>' . self::response()->getStatusString($code) . '</title>' . "\n" .
                '</head><body>' . "\n" .
                '<h1>' . self::response()->getStatusString($code) . '</h1>' . "\n" .
                '</body></html>';
        }
    }
1217013
public static function mapErrorCode($code)
    {
        $levelMap = [
            E_PARSE => 'error',
            E_ERROR => 'error',
            E_CORE_ERROR => 'error',
            E_COMPILE_ERROR => 'error',
            E_USER_ERROR => 'error',
            E_WARNING => 'warning',
            E_USER_WARNING => 'warning',
            E_COMPILE_WARNING => 'warning',
            E_RECOVERABLE_ERROR => 'warning',
            E_NOTICE => 'notice',
            E_USER_NOTICE => 'notice',
            E_STRICT => 'strict',
            E_DEPRECATED => 'deprecated',
            E_USER_DEPRECATED => 'deprecated',
        ];
        $logMap = [
            'error' => LOG_ERR,
            'warning' => LOG_WARNING,
            'notice' => LOG_NOTICE,
            'strict' => LOG_NOTICE,
            'deprecated' => LOG_NOTICE,
        ];

        $error = $levelMap[$code];
        $log = $logMap[$error];

        return [ucfirst($error), $log];
    }
287466
public static function getDescription($code)
    {
        if (array_key_exists($code, self::$codes_to_string_map)) {
            return self::$codes_to_string_map[$code];
        } else {
            return false;
        }
    }
296605
protected function translateErrorMessage($errorCode)
    {
        $message = self::UNKNOWN_ERROR_MESSAGE;

        if (isset(self::$errorMessages[$errorCode])) {
            $message = self::$errorMessages[$errorCode];
        }

        return $message;
    }
726375
public function getStatusText($code = null)
    {
        if ($code === null) {
            return $this->_context->status_text;
        } else {
            $texts = [
                200 => 'OK',
                201 => 'Created',
                202 => 'Accepted',
                203 => 'Non-Authoritative Information',
                204 => 'No Content',
                205 => 'Reset Content',
                206 => 'Partial Content',
                207 => 'Multi-Status',
                208 => 'Already Reported',
                301 => 'Moved Permanently',
                302 => 'Found',
                303 => 'See Other',
                304 => 'Not Modified',
                305 => 'Use Proxy',
                307 => 'Temporary Redirect',
                308 => 'Permanent Redirect',
                400 => 'Bad Request',
                401 => 'Unauthorized',
                402 => 'Payment Required',
                403 => 'Forbidden',
                404 => 'Not Found',
                405 => 'Method Not Allowed',
                406 => 'Not Acceptable',
                407 => 'Proxy Authentication Required',
                408 => 'Request Time-out',
                409 => 'Conflict',
                410 => 'Gone',
                411 => 'Length Required',
                412 => 'Precondition Failed',
                413 => 'Request Entity Too Large',
                414 => 'Request-URI Too Long',
                415 => 'Unsupported Media Type',
                416 => 'Requested range unsatisfiable',
                417 => 'Expectation failed',
                418 => 'I\'m a teapot',
                421 => 'Misdirected Request',
                422 => 'Unprocessable entity',
                423 => 'Locked',
                424 => 'Method failure',
                425 => 'Unordered Collection',
                426 => 'Upgrade Required',
                428 => 'Precondition Required',
                429 => 'Too Many Requests',
                431 => 'Request Header Fields Too Large',
                449 => 'Retry With',
                450 => 'Blocked by Windows Parental Controls',
                500 => 'Internal Server Error',
                501 => 'Not Implemented',
                502 => 'Bad Gateway or Proxy Error',
                503 => 'Service Unavailable',
                504 => 'Gateway Time-out',
                505 => 'HTTP Version not supported',
                507 => 'Insufficient storage',
                508 => 'Loop Detected',
                509 => 'Bandwidth Limit Exceeded',
                510 => 'Not Extended',
                511 => 'Network Authentication Required',
            ];

            return isset($texts[$code]) ? $texts[$code] : 'App Error';
        }
    }
419347
static function uploadErrorMmessage($error_code)
    {
        switch ($error_code) {
            case UPLOAD_ERR_INI_SIZE:
                return 'Превышен максимально допустимый размер файла';
            case UPLOAD_ERR_FORM_SIZE:
                return 'Превышен максимально допустимый размер, указанный в html форме';
            case UPLOAD_ERR_PARTIAL:
                return 'Файл загружен не полностью';
            case UPLOAD_ERR_NO_TMP_DIR:
                return 'Файл не сохранен во временной директории';
            case UPLOAD_ERR_CANT_WRITE:
                return 'Ошибка записи файла на диск';
            case UPLOAD_ERR_EXTENSION:
                return 'Загрузка файла прервана сервером';
            case UPLOAD_ERR_NO_FILE:
            default:
                return 'Файл не загружен';
        }
    }
1346984
public static function get_status_message($code) {
	if (!isset(static::$status_messages[$code])) {
		$code = self::STATUS_INTERNAL_SERVER_ERROR;
	}
	
	$message = static::$status_messages[$code];
	return $message;
}
199264
public function getErrorDescription()
    {
        if ($this->error === UPLOAD_ERR_OK) {
            return null;
        }
        
        $descs = static::ERROR_DESCRIPTIONS;
        return isset($descs[$this->error]) ? $descs[$this->error] : $descs[-1];
    }
241649
protected function getErrorByCode($code, $optional = '')
    {
        $error = new Error($code);
        $code = preg_replace(self::NUMBER_PATTERN, '', $code);
        $message = '';

        if (empty($code) && $optional) {
            $code = preg_replace(self::NUMBER_PATTERN, '', $optional);
        }

        if ($code) {
            $message = $this->getMessageError($code);
            $error->setCode($code);
        }

        return $error->setMessage($message);
    }
730991
public static function getPHPErrorSeverity($code) {
		$PHP_ERROR_LEVELS = [
			E_PARSE => \Psr\Log\LogLevel::ERROR,
			E_ERROR => \Psr\Log\LogLevel::ERROR,
			E_CORE_ERROR => \Psr\Log\LogLevel::ERROR,
			E_COMPILE_ERROR => \Psr\Log\LogLevel::ERROR,
			E_USER_ERROR => \Psr\Log\LogLevel::ERROR,
			E_RECOVERABLE_ERROR => \Psr\Log\LogLevel::ERROR,
			E_WARNING => \Psr\Log\LogLevel::WARNING,
			E_CORE_WARNING => \Psr\Log\LogLevel::WARNING,
			E_COMPILE_WARNING => \Psr\Log\LogLevel::WARNING,
			E_USER_WARNING => \Psr\Log\LogLevel::WARNING,
			E_NOTICE => \Psr\Log\LogLevel::NOTICE,
			E_USER_NOTICE => \Psr\Log\LogLevel::NOTICE,
			E_STRICT => \Psr\Log\LogLevel::NOTICE,
		];
		if(!isset($PHP_ERROR_LEVELS[$code]))
			return;
		return $PHP_ERROR_LEVELS[$code];
	}
112029
public function getErrorMessage($intCode, $arrOptions=array()) {
		if (isset($arrOptions['error']))
			return $arrOptions['error'];

		if (isset($arrOptions['message']))
			return $this->locale->insert($arrOptions['message'], array('value' => isset($arrOptions['value']) ? $arrOptions['value'] : $arrOptions['field'], 'field' => $arrOptions['field']));

		$field = isset($arrOptions['label']) ? $arrOptions['label'] : (isset($arrOptions['field']) ? $this->locale->get($arrOptions['field']) : '');

		switch ($intCode) {
			case FILTER_VALIDATE_REQUIRED:
				return $this->locale->insert('error.empty', array('value' => $field));
			case FILTER_VALIDATE_PASSWORD:
				return $this->locale->get('error.password');
			case FILTER_VALIDATE_USERNAME:
				return $this->locale->insert('error.username', array('value' => '"'.$arrOptions['value'].'"'));
			case FILTER_VALIDATE_IDENTIFIER:
				return $this->locale->insert('error.identifier', array('value' => '"'.$arrOptions['value'].'"'));
			case FILTER_VALIDATE_RESOURCE:
				return $this->locale->insert('error.resource', array('value' => '"'.$arrOptions['value'].'"'));
			case FILTER_VALIDATE_EMAIL:
				return $this->locale->insert('error.not_a_address', array('value' => '"'.$arrOptions['value'].'"', 'type' => 'E-mail'));
			case FILTER_VALIDATE_IPV4:
				return $this->locale->insert('error.not_a_address', array('value' => '"'.$arrOptions['value'].'"', 'type' => 'IPv4'));
			case FILTER_VALIDATE_IPV6:
				return $this->locale->insert('error.not_a_address', array('value' => '"'.$arrOptions['value'].'"', 'type' => 'IPv6'));
			case FILTER_VALIDATE_IP:
				return $this->locale->insert('error.not_a_address', array('value' => '"'.$arrOptions['value'].'"', 'type' => 'IP'));
			case FILTER_VALIDATE_URL:
				return $this->locale->insert('error.not_a_url', array('value' => $arrOptions['value']));
			case FILTER_VALIDATE_FLOAT:
				return $this->locale->insert('error.not_a_number', array('value' => $field));
			case FILTER_VALIDATE_INT:
				if (isset($arrOptions['min_range']) && isset($arrOptions['max_range']))
					return $this->locale->insert('error.in_between', array('value' => $field, 'min' => $arrOptions['min_range'], 'max' => $arrOptions['max_range']));
				elseif (isset($arrOptions['min_range']))
					return $this->locale->insert('error.greater_than', array('value' => $field, 'count' => $arrOptions['min_range']));
				elseif (isset($arrOptions['max_range']))
					return $this->locale->insert('error.less_than', array('value' => $field, 'count' => $arrOptions['max_range']));
				else
					return $this->locale->insert('error.not_a_int', array('value' => $field));
			case FILTER_VALIDATE_BOOLEAN:
				break;
			case FILTER_VALIDATE_MIN_LENGTH:
				return $this->locale->insert('error.too_short', array('value' => $field, 'count' => $arrOptions['len']));
			case FILTER_VALIDATE_MAX_LENGTH:
				return $this->locale->insert('error.too_long', array('value' => $field, 'count' => $arrOptions['len']));
			case FILTER_VALIDATE_LENGTH:
				return $this->locale->insert('error.wrong_range', array('value' => $field, 'min' => $arrOptions['min'], 'max' => $arrOptions['max']));
			case FILTER_VALIDATE_DATE_RANGE:
				$arrOptions['format'] = isset($arrOptions['format']) ? $arrOptions['format'] : $this->locale->getDateFormat('date.format.default');
				return $this->locale->insert('error.date_range', array('value' => $field, 'min' => date($arrOptions['format'], $arrOptions['min']), 'max' => date($arrOptions['format'], $arrOptions['max'])));
			case FILTER_VALIDATE_DATE_START_END:
				$arrOptions['format'] = isset($arrOptions['format']) ? $arrOptions['format'] : $this->locale->getDateFormat('date.format.default');
				return $this->locale->insert('error.date_start_end', array('value' => $field, 'end' => date($arrOptions['format'], $arrOptions['end'])));
			default:
				// too_long
				// too_short
				// empty (Muss ausgefüllt werden)
				// invalid
				// start_before_end
				// range: Ist keine gültige {model}
				break;
		}

		return $this->locale->insert('error.invalid', array('value' => isset($arrOptions['value']) ? $arrOptions['value'] : $field, 'field' => $field));
	}
782551
public function file_error_message( $key ) {
		if ( $this->file_info( $key ) ) {
			return '';
		} elseif ( ! isset( $_FILES[ $key ] ) ) {
			return $this->__( 'File is not specified.' );
		} else {
			switch ( $_FILES[ $key ]['error'] ) {
				case UPLOAD_ERR_FORM_SIZE:
				case UPLOAD_ERR_INI_SIZE:
					return $this->__( 'Uploaded file size exceeds allowed limit.' );
					break;
				default:
					return $this->__( 'Failed to upload' );
					break;
			}
		}
	}