You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
58 lines
1.9 KiB
58 lines
1.9 KiB
<?php
|
|
namespace AliyunMNS\Responses;
|
|
|
|
use AliyunMNS\Constants;
|
|
use AliyunMNS\Exception\MnsException;
|
|
use AliyunMNS\Exception\QueueNotExistException;
|
|
use AliyunMNS\Exception\InvalidArgumentException;
|
|
use AliyunMNS\Responses\BaseResponse;
|
|
use AliyunMNS\Common\XMLParser;
|
|
|
|
class SetQueueAttributeResponse extends BaseResponse
|
|
{
|
|
public function __construct()
|
|
{
|
|
}
|
|
|
|
public function parseResponse($statusCode, $content)
|
|
{
|
|
$this->statusCode = $statusCode;
|
|
if ($statusCode == 204) {
|
|
$this->succeed = TRUE;
|
|
} else {
|
|
$this->parseErrorResponse($statusCode, $content);
|
|
}
|
|
}
|
|
|
|
public function parseErrorResponse($statusCode, $content, MnsException $exception = NULL)
|
|
{
|
|
$this->succeed = FALSE;
|
|
$xmlReader = $this->loadXmlContent($content);
|
|
try {
|
|
$result = XMLParser::parseNormalError($xmlReader);
|
|
|
|
if ($result['Code'] == Constants::INVALID_ARGUMENT)
|
|
{
|
|
throw new InvalidArgumentException($statusCode, $result['Message'], $exception, $result['Code'], $result['RequestId'], $result['HostId']);
|
|
}
|
|
if ($result['Code'] == Constants::QUEUE_NOT_EXIST)
|
|
{
|
|
throw new QueueNotExistException($statusCode, $result['Message'], $exception, $result['Code'], $result['RequestId'], $result['HostId']);
|
|
}
|
|
throw new MnsException($statusCode, $result['Message'], $exception, $result['Code'], $result['RequestId'], $result['HostId']);
|
|
} catch (\Exception $e) {
|
|
if ($exception != NULL) {
|
|
throw $exception;
|
|
} elseif($e instanceof MnsException) {
|
|
throw $e;
|
|
} else {
|
|
throw new MnsException($statusCode, $e->getMessage());
|
|
}
|
|
} catch (\Throwable $t) {
|
|
throw new MnsException($statusCode, $t->getMessage());
|
|
}
|
|
}
|
|
}
|
|
|
|
?>
|