|
|
@@ -34,6 +34,12 @@ class Zend_Rest_Client_Result implements IteratorAggregate {
|
|
|
protected $_sxml;
|
|
|
|
|
|
/**
|
|
|
+ * error information
|
|
|
+ * @var string
|
|
|
+ */
|
|
|
+ protected $_errstr;
|
|
|
+
|
|
|
+ /**
|
|
|
* Constructor
|
|
|
*
|
|
|
* @param string $data XML Result
|
|
|
@@ -43,10 +49,16 @@ class Zend_Rest_Client_Result implements IteratorAggregate {
|
|
|
{
|
|
|
set_error_handler(array($this, 'handleXmlErrors'));
|
|
|
$this->_sxml = simplexml_load_string($data);
|
|
|
+ restore_error_handler();
|
|
|
if($this->_sxml === false) {
|
|
|
- $this->handleXmlErrors(0, "An error occured while parsing the REST response with simplexml.");
|
|
|
- } else {
|
|
|
- restore_error_handler();
|
|
|
+ if ($this->_errstr === null) {
|
|
|
+ $message = "An error occured while parsing the REST response with simplexml.";
|
|
|
+ } else {
|
|
|
+ $message = "REST Response Error: " . $this->_errstr;
|
|
|
+ $this->_errstr = null;
|
|
|
+ }
|
|
|
+ require_once "Zend/Rest/Client/Result/Exception.php";
|
|
|
+ throw new Zend_Rest_Client_Result_Exception($message);
|
|
|
}
|
|
|
}
|
|
|
|
|
|
@@ -58,13 +70,12 @@ class Zend_Rest_Client_Result implements IteratorAggregate {
|
|
|
* @param string $errfile
|
|
|
* @param string $errline
|
|
|
* @param array $errcontext
|
|
|
- * @throws Zend_Result_Client_Result_Exception
|
|
|
+ * @return true
|
|
|
*/
|
|
|
public function handleXmlErrors($errno, $errstr, $errfile = null, $errline = null, array $errcontext = null)
|
|
|
{
|
|
|
- restore_error_handler();
|
|
|
- require_once "Zend/Rest/Client/Result/Exception.php";
|
|
|
- throw new Zend_Rest_Client_Result_Exception("REST Response Error: ".$errstr);
|
|
|
+ $this->_errstr = $errstr;
|
|
|
+ return true;
|
|
|
}
|
|
|
|
|
|
/**
|