Returns the error message associated with the $jsonErrorCode.

@param $jsonErrorCode

@return string
486683
private function jsonDecodeErrorMessage($jsonErrorCode)
    {
        if (function_exists('json_last_error_msg')) {
            return json_last_error_msg();
        }
        switch ($jsonErrorCode) {
            case JSON_ERROR_DEPTH:
                return 'Maximum stack depth exceeded';
            case JSON_ERROR_STATE_MISMATCH:
                return 'Underflow or the modes mismatch';
            case JSON_ERROR_CTRL_CHAR:
                return 'Unexpected control character found';
            case JSON_ERROR_SYNTAX:
                return 'Syntax error, malformed JSON';
            case JSON_ERROR_UTF8:
                return 'Malformed UTF-8 characters, possibly incorrectly encoded';
        }

        return 'Unknown JSON decode 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 'Файл не загружен';
        }
    }
597064
public static function parseErrors($json_string)
    {
        $error_obj = json_decode($json_string);
        $errors = [];
        if (!empty($error_obj->errors)) {
            foreach ($error_obj->errors as $error) {
                $errors[] = new self($error->code, $error->path, $error->description);
            }
        } elseif (!empty($error_obj->error)) {
            $errors[] = new self('', '', $error_obj->error);
        }

        return $errors;
    }
1188498
final public function get($code = null) {

        if ( is_null($code) ) return $this->rpc_errors;

        else if ( array_key_exists($code, $this->rpc_errors) ) return $this->rpc_errors[$code];

        else if ( $code >= -32099 && $code <= -32000 ) return 'Server Error';

        else return 'Unknown Error';

    }
510302
protected function fetchJsonError($json) {
		if (!$json->ok) {
			if (isset($this->errorMessages[$json->error])) {
				$errorMessage = $this->errorMessages[$json->error];
			} else {
				$errorMessage = 'Unknown error';
			}
			return array(
				'code' => $json->error,
				'message' => $errorMessage,
			);
		}
		else {
			return null;
		}
	}
1197595
public function getFriendlyUploadError($error_code = '') {
		switch ($error_code) {
			case UPLOAD_ERR_OK:
				return '';

			case UPLOAD_ERR_INI_SIZE:
				$key = 'ini_size';
				break;

			case UPLOAD_ERR_FORM_SIZE:
				$key = 'form_size';
				break;

			case UPLOAD_ERR_PARTIAL:
				$key = 'partial';
				break;

			case UPLOAD_ERR_NO_FILE:
				$key = 'no_file';
				break;

			case UPLOAD_ERR_NO_TMP_DIR:
				$key = 'no_tmp_dir';
				break;

			case UPLOAD_ERR_CANT_WRITE:
				$key = 'cant_write';
				break;

			case UPLOAD_ERR_EXTENSION:
				$key = 'extension';
				break;

			default:
				$key = 'unknown';
				break;
		}

		return elgg_echo("upload:error:$key");
	}
233358
private function getJsonErrorName($error)
    {
        $matches = array_keys(get_defined_constants(), $error, true);
        $prefix = 'JSON_ERROR_';
        $prefixLength = strlen($prefix);
        $name = 'UNKNOWN_ERROR';

        foreach ($matches as $match) {
            if (is_string($match) && strncmp($match, $prefix, $prefixLength) === 0) {
                $name = $match;
                break;
            }
        }

        return $name;
    }
985254
public static function lastJsonErrorMessage()
    {
        if (defined('json_last_error_msg')) {
            return json_last_error_msg();
        }

        $lastError = json_last_error();

        if (isset(self::$jsonErrors[$lastError])) {
            return self::$jsonErrors[$lastError];
        }

        return 'Unknown error';
    }
758224
protected function fetchJsonError($json) {
		if (isset($json->error)) {
			return array(
				'code' => $json->error_code,
				'message' => $json->error_description,
			);
		}
		else {
			return null;
		}
	}
388172
private function showErrorMsg(int $httpCode, int $errorCode, string $errorType, string $message, array $traceArr, string $file, int $line)
    {
        if (empty($traceArr)) {
            $traceArr = debug_backtrace();
        }
        $content = $this->getErrContent();
        $mainTitle = 'HTTP 错误 ' . $httpCode;
        $errmsgPrefix = '<span style="color:red;">[' . $errorType . ']</span>[' . $errorCode . '] ';
        $errFile = '<span style="color:red;">[file]</span> ' . $file . ' on line <b>' . $line . '</b>';
        $showSource = Application::$app->config->getValue('ERROR_HANDLER_SHOW_SOURCE');
        $mainSource = '';
        $showMainSourceFn = 'javascript:void(0);';
        if ($showSource) {
            $mainSource = 'filesArr.push(' . json_encode($file) . ');
linesArr.push(' . $line . ');
contentArr.push(' . json_encode(htmlspecialchars(file_get_contents($file))) . ');';
            $showMainSourceFn = 'show_source_main();';
        }
        $content = str_replace([
            '{mainTitle}',
            '{errMsg}',
            '{errFile}',
            '{errTrace}',
            '{prettify.css}',
            '{prettify.js}',
            '{main_source}',
            '{showMainSourceFn}'
        ], [
            $mainTitle,
            $errmsgPrefix . htmlspecialchars($message),
            $errFile,
            $this->getTableHtml($traceArr),
            $showSource ? file_get_contents(Application::$app->mvcSourcePath . '/../static/prettify.css') : '',
            $showSource ? file_get_contents(Application::$app->mvcSourcePath . '/../static/prettify.js') : '',
            $mainSource,
            $showMainSourceFn
        ], $content);
        $actionResult = new ContentResult($content);
        $actionResult->statusCode = $httpCode;
        $actionResult->executeResult();
        exit();
    }
722962
protected final function error($code, $message = null) {
        if (empty($message) && is_string($code)) {
            $msg = explode('@', $code);
            if (count($msg) >= 2) {
                $message = $msg[1];
                $code    = intval($msg[0]);
            } else {
                $message = $code;
                $code    = 500;
            }
        } else if (empty($message)) {
            $message = __('Internal Error');
        }
        throw new RestException($message, $code);
    }
1156656
public static function fileUploadErrorText($error_code): string
    {
        switch ($error_code) {
            case UPLOAD_ERR_OK:
                return I18N::translate('File successfully uploaded');
            case UPLOAD_ERR_INI_SIZE:
            case UPLOAD_ERR_FORM_SIZE:
                // I18N: PHP internal error message - php.net/manual/en/features.file-upload.errors.php
                return I18N::translate('The uploaded file exceeds the allowed size.');
            case UPLOAD_ERR_PARTIAL:
                // I18N: PHP internal error message - php.net/manual/en/features.file-upload.errors.php
                return I18N::translate('The file was only partially uploaded. Please try again.');
            case UPLOAD_ERR_NO_FILE:
                // I18N: PHP internal error message - php.net/manual/en/features.file-upload.errors.php
                return I18N::translate('No file was received. Please try again.');
            case UPLOAD_ERR_NO_TMP_DIR:
                // I18N: PHP internal error message - php.net/manual/en/features.file-upload.errors.php
                return I18N::translate('The PHP temporary folder is missing.');
            case UPLOAD_ERR_CANT_WRITE:
                // I18N: PHP internal error message - php.net/manual/en/features.file-upload.errors.php
                return I18N::translate('PHP failed to write to disk.');
            case UPLOAD_ERR_EXTENSION:
                // I18N: PHP internal error message - php.net/manual/en/features.file-upload.errors.php
                return I18N::translate('PHP blocked the file because of its extension.');
            default:
                return 'Error: ' . $error_code;
        }
    }
243608
public function jsonResponseError(array $data = [], $status = 400, $code = 'error', array $headers = [], $options = 0)
    {
        return $this->jsonResponse()->error($data, $status, $code, $headers, $options);
    }
796708
protected function getErrorMessage($nCode, $strMessage = null)
    {
        $strReturn = 'Failure: ';
        if (null !== $this->strResourcePath) {
            $strReturn = 'Path: "'.$this->strResourcePath.'" ';
        }
        $strReturn .= 'Name: "'.$this->strResourceName.'"';
        $strReturn .= ' Code: ';
        switch ($nCode) {
            case self::FAILURE_IO:
                $strReturn .= 'General IO Error';
                break;
            case self::FAILURE_NOT_WRITEABLE:
                $strReturn .= 'not writeable';
                break;
            case self::FAILURE_NOT_READABLE:
                $strReturn .= 'not readable';
                break;
            case self::FAILURE_NOT_FOUND:
                $strReturn .= 'not found';
                break;
            default:
                $strReturn .= (string) $nCode;
                break;
        }
        if (null !== $strMessage) {
            $strReturn .= ' with message: "'.$strMessage.'"';
        }

        return $strReturn;
    }
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;
}
341727
protected static function getErrorMessage($code)
    {
        $string = socket_strerror($code);

        // search constant starting with SOCKET_ for this error code
        foreach (get_defined_constants() as $key => $value) {
            if($value === $code && strpos($key, 'SOCKET_') === 0) {
                $string .= ' (' . $key . ')';
                break;
            }
        }

        return $string;
    }
269426
public function error( $message, $code = null, $data = null )
    {
        if ( null === $code && isset( $this->errorCodes[$message] ) )
        {
            $code = $this->errorCodes[$message];
        }

        return $this->getResponse( 'error', (object) array(
            'code'      => $code,
            'message'   => $message,
            'data'      => $data,
        ) );
    }