• Модуль: seo
  • Путь к файлу: ~/bitrix/modules/seo/lib/engine/yandexexception.php
  • Класс: BitrixSeoEngineYandexException
  • Вызов: YandexException::parseError
protected function parseError()
{
	$matches = array();
//		old style dbg: maybe delete? In new webmaster API this format not using already
	if (preg_match("/([^<]+)/", $this->result, $matches))
	{
		$this->code = $matches[1];
		$this->message = $matches[2];
		
//			Try translate error. If unknown error - write as is
		$codeTranslated = Loc::getMessage('YANDEX_ERROR__'.str_replace(' ','_',ToUpper($this->code)));
		$messageTranslated = Loc::getMessage('YANDEX_ERROR__'.str_replace(' ','_',ToUpper($this->message)));
		$this->code = ($codeTranslated <> '') ? $codeTranslated : $this->code;
		$this->message = ($messageTranslated <> '') ? $messageTranslated : $this->message;
		
		return true;
	}
	
//		new style
	if ($resultArray = Json::decode($this->result))
	{
		if (array_key_exists('error_code', $resultArray))
			$this->code = $resultArray["error_code"];
		if (array_key_exists('error_message', $resultArray))
			$this->message = $resultArray["error_message"];
		
		return true;
	}
	
	return false;
}