Ejemplo n.º 1
0
 public function parseErrorResponse($statusCode, $content, MnsException $exception = NULL)
 {
     $this->succeed = FALSE;
     $xmlReader = $this->loadXmlContent($content);
     try {
         $result = XMLParser::parseNormalError($xmlReader);
         if ($result['Code'] == Constants::TOPIC_NOT_EXIST) {
             throw new TopicNotExistException($statusCode, $result['Message'], $exception, $result['Code'], $result['RequestId'], $result['HostId']);
         }
         if ($result['Code'] == Constants::INVALID_ARGUMENT) {
             throw new InvalidArgumentException($statusCode, $result['Message'], $exception, $result['Code'], $result['RequestId'], $result['HostId']);
         }
         if ($result['Code'] == Constants::MALFORMED_XML) {
             throw new MalformedXMLException($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());
     }
 }
 public function parseErrorResponse($statusCode, $content, MnsException $exception = NULL)
 {
     $this->succeed = FALSE;
     $xmlReader = new \XMLReader();
     try {
         $xmlReader->XML($content);
         $result = XMLParser::parseNormalError($xmlReader);
         if ($result['Code'] == Constants::QUEUE_NOT_EXIST) {
             throw new QueueNotExistException($statusCode, $result['Message'], $exception, $result['Code'], $result['RequestId'], $result['HostId']);
         }
         if ($result['Code'] == Constants::MESSAGE_NOT_EXIST) {
             throw new MessageNotExistException($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());
     }
 }
 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']);
         }
         if ($result['Code'] == Constants::MESSAGE_NOT_EXIST) {
             throw new MessageNotExistException($statusCode, $result['Message'], $exception, $result['Code'], $result['RequestId'], $result['HostId']);
         }
         if ($result['Code'] == Constants::RECEIPT_HANDLE_ERROR) {
             throw new ReceiptHandleErrorException($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());
     }
 }
 public function parseErrorResponse($statusCode, $content, MnsException $exception = NULL)
 {
     $this->succeed = FALSE;
     $xmlReader = new \XMLReader();
     try {
         $xmlReader->XML($content);
         $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::SUBSCRIPTION_NOT_EXIST) {
             throw new SubscriptionNotExistException($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());
     }
 }
 private function parseNormalErrorResponse($xmlReader)
 {
     $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']);
     }
     if ($result['Code'] == Constants::RECEIPT_HANDLE_ERROR) {
         throw new ReceiptHandleErrorException($statusCode, $result['Message'], $exception, $result['Code'], $result['RequestId'], $result['HostId']);
     }
     throw new MnsException($statusCode, $result['Message'], $exception, $result['Code'], $result['RequestId'], $result['HostId']);
 }
Ejemplo n.º 6
0
 public function parseErrorResponse($statusCode, $content, MnsException $exception = NULL)
 {
     $this->succeed = FALSE;
     $xmlReader = $this->loadXmlContent($content);
     try {
         $result = XMLParser::parseNormalError($xmlReader);
         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());
     }
 }
 private function parseNormalErrorResponse($xmlReader)
 {
     $result = XMLParser::parseNormalError($xmlReader);
     if ($result['Code'] == Constants::QUEUE_NOT_EXIST) {
         throw new QueueNotExistException($statusCode, $result['Message'], $exception, $result['Code'], $result['RequestId'], $result['HostId']);
     }
     if ($result['Code'] == Constants::INVALID_ARGUMENT) {
         throw new InvalidArgumentException($statusCode, $result['Message'], $exception, $result['Code'], $result['RequestId'], $result['HostId']);
     }
     if ($result['Code'] == Constants::MALFORMED_XML) {
         throw new MalformedXMLException($statusCode, $result['Message'], $exception, $result['Code'], $result['RequestId'], $result['HostId']);
     }
     throw new MnsException($statusCode, $result['Message'], $exception, $result['Code'], $result['RequestId'], $result['HostId']);
 }