@@ 257-266 (lines=10) @@ | ||
254 | * |
|
255 | * @return array |
|
256 | */ |
|
257 | private function clientError(\GuzzleHttp\Exception\ClientException $exception) |
|
258 | { |
|
259 | $body = (string) $exception->getResponse()->getBody(); |
|
260 | ||
261 | return [ |
|
262 | 'status' => 'error', |
|
263 | 'http_code' => $exception->getResponse()->getStatusCode(), |
|
264 | 'body' => json_decode($body), |
|
265 | ]; |
|
266 | } |
|
267 | ||
268 | /** |
|
269 | * Parse the java exception that we receive from Smartcall's Tomcat's. |
|
@@ 275-284 (lines=10) @@ | ||
272 | * |
|
273 | * @return array |
|
274 | */ |
|
275 | private function parseError(\GuzzleHttp\Exception\ServerException $exception) |
|
276 | { |
|
277 | $body = (string) $exception->getResponse()->getBody(); |
|
278 | preg_match('!<p><b>type</b> Exception report</p><p><b>message</b> <u>(.*[^</u>])</u></p><p><b>description</b>!', $body, $matches); |
|
279 | ||
280 | return [ |
|
281 | 'status' => 'error', |
|
282 | 'http_code' => $exception->getResponse()->getStatusCode(), |
|
283 | 'body' => $matches['1'], |
|
284 | ]; |
|
285 | } |
|
286 | ||
287 | /** |