/** * Checks for errors responses from Amazon * * @param Zend_Service_Amazon_Ec2_Response $response the response object to * check. * * @return void * * @throws Zend_Service_Amazon_Ec2_Exception if one or more errors are * returned from Amazon. */ private function checkForErrors(Zend_Service_Amazon_Ec2_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 Zend_Service_Amazon_Ec2_Exception($message, 0, $code); } }