/** * Convert an exception to an ServiceException if an AppsForYourDomain * XML document is contained within the original exception's HTTP * response. If conversion fails, throw the original error. * * @param Zend_Gdata_Exception $e The exception to convert. * @throws Zend_Gdata_Gapps_ServiceException * @throws mixed */ public static function throwServiceExceptionIfDetected($e) { try { // Check to see if there is an AppsForYourDomainErrors // datastructure in the response. If so, convert it to // an exception and throw it. require_once 'Zend/Gdata/Gapps/ServiceException.php'; $error = new Zend_Gdata_Gapps_ServiceException(); $error->importFromString($e->getResponse()->getBody()); throw $error; } catch (Zend_Gdata_App_Exception $e2) { // Unable to convert the response to a ServiceException, // most likely because the server didn't return an // AppsForYourDomainErrors document. Throw the original // exception. throw $e; } }
/** * Convert an exception to an ServiceException if an AppsForYourDomain * XML document is contained within the original exception's HTTP * response. If conversion fails, throw the original error. * * @param Zend_Gdata_Exception $e The exception to convert. * @throws Zend_Gdata_Gapps_ServiceException * @throws mixed */ public static function throwServiceExceptionIfDetected($e) { // Check to make sure that there actually response! // This can happen if the connection dies before the request // completes. (See ZF-5949) $response = $e->getResponse(); if (!$response) { // require_once('Zend/Gdata/App/IOException.php'); throw new Zend_Gdata_App_IOException('No HTTP response received (possible connection failure)'); } try { // Check to see if there is an AppsForYourDomainErrors // datastructure in the response. If so, convert it to // an exception and throw it. // require_once 'Zend/Gdata/Gapps/ServiceException.php'; $error = new Zend_Gdata_Gapps_ServiceException(); $error->importFromString($response->getBody()); throw $error; } catch (Zend_Gdata_App_Exception $e2) { // Unable to convert the response to a ServiceException, // most likely because the server didn't return an // AppsForYourDomainErrors document. Throw the original // exception. throw $e; } }
public function __construct($message = null, $e = null) { $this->_httpClientException = $e; parent::__construct($message); }