• Модуль: dav
  • Путь к файлу: ~/bitrix/modules/dav/classes/general/exchangeclient.php
  • Класс: CDavExchangeClient
  • Вызов: CDavExchangeClient::ParseError
protected function ParseError($response)
{
	$code = $response->GetStatus('code');
	$isErrorCode = false;

	if ((int)$code === 401)
	{
		$this->arError[] = array(401, $response->GetStatus('phrase'));
		$isErrorCode = true;
	}
	elseif ((int)$code == 500)
	{
		try
		{
			$xmlDoc = $response->GetBodyXml();
		}
		catch (Exception $e)
		{
			$this->arError[] = array($e->getCode(), $e->getMessage());
			return;
		}

		$arFault = $xmlDoc->GetPath("/Envelope/Body/Fault");
		foreach ($arFault as $fault)
		{
			$errorCode = "";
			$arResponseCode = $fault->GetPath("/Fault/detail/ResponseCode");
			if (!empty($arResponseCode))
			{
				$errorCode = $arResponseCode[0]->GetContent();
			}
			else
			{
				$arFaultCode = $fault->GetPath("/Fault/faultcode");
				if (!empty($arFaultCode))
				{
					$errorCode = $arFaultCode[0]->GetContent();
				}
			}

			$errorMessage = "";
			$arMessage = $fault->GetPath("/Fault/detail/Message");
			if (!empty($arMessage))
			{
				$errorMessage = $arMessage[0]->GetContent();
			}
			else
			{
				$arFaultString = $fault->GetPath("/Fault/faultstring");
				if (!empty($arFaultString))
				{
					$errorMessage = $arFaultString[0]->GetContent();
				}
			}

			$this->arError[] = array($this->Encode($errorCode), $this->Encode($errorMessage));
		}
		$isErrorCode = true;
	}

	return $isErrorCode;
}