1 | <?php
|
---|
2 |
|
---|
3 | /**
|
---|
4 | * Zend Framework
|
---|
5 | *
|
---|
6 | * LICENSE
|
---|
7 | *
|
---|
8 | * This source file is subject to the new BSD license that is bundled
|
---|
9 | * with this package in the file LICENSE.txt.
|
---|
10 | * It is also available through the world-wide-web at this URL:
|
---|
11 | * http://framework.zend.com/license/new-bsd
|
---|
12 | * If you did not receive a copy of the license and are unable to
|
---|
13 | * obtain it through the world-wide-web, please send an email
|
---|
14 | * to license@zend.com so we can send you a copy immediately.
|
---|
15 | *
|
---|
16 | * @category Zend
|
---|
17 | * @package Zend_Gdata
|
---|
18 | * @subpackage App
|
---|
19 | * @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com)
|
---|
20 | * @license http://framework.zend.com/license/new-bsd New BSD License
|
---|
21 | */
|
---|
22 |
|
---|
23 | /**
|
---|
24 | * Zend_Gdata_App_Exception
|
---|
25 | */
|
---|
26 | require_once 'Zend/Gdata/App/Exception.php';
|
---|
27 |
|
---|
28 | /**
|
---|
29 | * Zend_Http_Client_Exception
|
---|
30 | */
|
---|
31 | require_once 'Zend/Http/Client/Exception.php';
|
---|
32 |
|
---|
33 | /**
|
---|
34 | * Gdata exceptions
|
---|
35 | *
|
---|
36 | * Class to represent exceptions that occur during Gdata operations.
|
---|
37 | *
|
---|
38 | * @category Zend
|
---|
39 | * @package Zend_Gdata
|
---|
40 | * @subpackage App
|
---|
41 | * @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com)
|
---|
42 | * @license http://framework.zend.com/license/new-bsd New BSD License
|
---|
43 | */
|
---|
44 | class Zend_Gdata_App_HttpException extends Zend_Gdata_App_Exception
|
---|
45 | {
|
---|
46 |
|
---|
47 | protected $_httpClientException = null;
|
---|
48 | protected $_response = null;
|
---|
49 |
|
---|
50 | /**
|
---|
51 | * Create a new Zend_Gdata_App_HttpException
|
---|
52 | *
|
---|
53 | * @param string $message Optionally set a message
|
---|
54 | * @param Zend_Http_Client_Exception Optionally pass in a Zend_Http_Client_Exception
|
---|
55 | * @param Zend_Http_Response Optionally pass in a Zend_Http_Response
|
---|
56 | */
|
---|
57 | public function __construct($message = null, $e = null, $response = null)
|
---|
58 | {
|
---|
59 | $this->_httpClientException = $e;
|
---|
60 | $this->_response = $response;
|
---|
61 | parent::__construct($message);
|
---|
62 | }
|
---|
63 |
|
---|
64 | /**
|
---|
65 | * Get the Zend_Http_Client_Exception.
|
---|
66 | *
|
---|
67 | * @return Zend_Http_Client_Exception
|
---|
68 | */
|
---|
69 | public function getHttpClientException()
|
---|
70 | {
|
---|
71 | return $this->_httpClientException;
|
---|
72 | }
|
---|
73 |
|
---|
74 | /**
|
---|
75 | * Set the Zend_Http_Client_Exception.
|
---|
76 | *
|
---|
77 | * @param Zend_Http_Client_Exception $value
|
---|
78 | */
|
---|
79 | public function setHttpClientException($value)
|
---|
80 | {
|
---|
81 | $this->_httpClientException = $value;
|
---|
82 | return $this;
|
---|
83 | }
|
---|
84 |
|
---|
85 | /**
|
---|
86 | * Set the Zend_Http_Response.
|
---|
87 | *
|
---|
88 | * @param Zend_Http_Response $response
|
---|
89 | */
|
---|
90 | public function setResponse($response)
|
---|
91 | {
|
---|
92 | $this->_response = $response;
|
---|
93 | return $this;
|
---|
94 | }
|
---|
95 |
|
---|
96 | /**
|
---|
97 | * Get the Zend_Http_Response.
|
---|
98 | *
|
---|
99 | * @return Zend_Http_Response
|
---|
100 | */
|
---|
101 | public function getResponse()
|
---|
102 | {
|
---|
103 | return $this->_response;
|
---|
104 | }
|
---|
105 |
|
---|
106 | /**
|
---|
107 | * Get the body of the Zend_Http_Response
|
---|
108 | *
|
---|
109 | * @return string
|
---|
110 | */
|
---|
111 | public function getRawResponseBody()
|
---|
112 | {
|
---|
113 | if ($this->getResponse()) {
|
---|
114 | $response = $this->getResponse();
|
---|
115 | return $response->getRawBody();
|
---|
116 | }
|
---|
117 | return null;
|
---|
118 | }
|
---|
119 |
|
---|
120 | }
|
---|