Example #1
0
 /**
  * Checks for errors responses from Amazon
  *
  * @param Response $response the response object to
  *                                                   check.
  *
  * @return void
  *
  * @throws Exception\RuntimeException if one or more errors are
  *         returned from Amazon.
  */
 private function _checkForErrors(Response $response)
 {
     $xpath = new DOMXPath($response->getDocument());
     $list = $xpath->query('//Error');
     if ($list->length > 0) {
         $node = $list->item(0);
         $code = $xpath->evaluate('string(Code/text())', $node);
         $message = $xpath->evaluate('string(Message/text())', $node);
         throw new Exception\RuntimeException($message, (double) $code);
     }
 }