1 | <?php |
||
29 | class RequestException extends Exception |
||
30 | { |
||
31 | /** |
||
32 | * @var int Status code for the response causing the exception |
||
33 | */ |
||
34 | protected $statusCode; |
||
35 | |||
36 | /** |
||
37 | * @var int|null |
||
38 | */ |
||
39 | protected $errorCode; |
||
40 | |||
41 | /** |
||
42 | * @var int|null |
||
43 | */ |
||
44 | protected $errorSubcode; |
||
45 | |||
46 | /** |
||
47 | * @var string|null |
||
48 | */ |
||
49 | protected $errorMessage; |
||
50 | |||
51 | /** |
||
52 | * @var string|null |
||
53 | */ |
||
54 | protected $errorUserTitle; |
||
55 | |||
56 | /** |
||
57 | * @var string|null |
||
58 | */ |
||
59 | protected $errorUserMessage; |
||
60 | |||
61 | /** |
||
62 | * @var int|null |
||
63 | */ |
||
64 | protected $errorType; |
||
65 | |||
66 | /** |
||
67 | * @var array|null |
||
68 | */ |
||
69 | protected $errorBlameFieldSpecs; |
||
70 | |||
71 | /** |
||
72 | * @param array $response_data The response from the Graph API |
||
73 | * @param int $status_code |
||
74 | */ |
||
75 | 8 | public function __construct( |
|
89 | |||
90 | /** |
||
91 | * @param array $array |
||
92 | * @param string|int $key |
||
93 | * @param mixed $default |
||
94 | * @return mixed |
||
95 | */ |
||
96 | 8 | protected static function idx(array $array, $key, $default = null) |
|
102 | |||
103 | /** |
||
104 | * @param array $response_data |
||
105 | * @return array |
||
106 | */ |
||
107 | 8 | protected static function getErrorData(array $response_data) |
|
125 | |||
126 | /** |
||
127 | * Process an error payload from the Graph API and return the appropriate |
||
128 | * exception subclass. |
||
129 | * @param array $response_data the decoded response from the Graph API |
||
130 | * @param int $status_code the HTTP response code |
||
131 | * @return RequestException |
||
132 | */ |
||
133 | 7 | public static function create(array $response_data, $status_code) |
|
153 | |||
154 | /** |
||
155 | * @return int |
||
156 | */ |
||
157 | 1 | public function getHttpStatusCode() |
|
161 | |||
162 | /** |
||
163 | * @return int|null |
||
164 | */ |
||
165 | 1 | public function getErrorSubcode() |
|
169 | |||
170 | /** |
||
171 | * @return string|null |
||
172 | */ |
||
173 | 1 | public function getErrorUserTitle() |
|
177 | |||
178 | /** |
||
179 | * @return string|null |
||
180 | */ |
||
181 | 1 | public function getErrorUserMessage() |
|
185 | |||
186 | /** |
||
187 | * @return array|null |
||
188 | */ |
||
189 | 1 | public function getErrorBlameFieldSpecs() |
|
193 | } |
||
194 |