@@ 378-387 (lines=10) @@ | ||
375 | * |
|
376 | * @return array |
|
377 | */ |
|
378 | private function clientError(\GuzzleHttp\Exception\ClientException $exception) |
|
379 | { |
|
380 | $body = (string) $exception->getResponse()->getBody(); |
|
381 | ||
382 | return [ |
|
383 | 'status' => 'error', |
|
384 | 'http_code' => $exception->getResponse()->getStatusCode(), |
|
385 | 'body' => json_decode($body), |
|
386 | ]; |
|
387 | } |
|
388 | ||
389 | /** |
|
390 | * Parse the java exception that we receive from Smartcall's Tomcat's. |
|
@@ 396-405 (lines=10) @@ | ||
393 | * |
|
394 | * @return array |
|
395 | */ |
|
396 | private function parseError(\GuzzleHttp\Exception\ServerException $exception) |
|
397 | { |
|
398 | $body = (string) $exception->getResponse()->getBody(); |
|
399 | preg_match('!<p><b>type</b> Exception report</p><p><b>message</b> <u>(.*[^</u>])</u></p><p><b>description</b>!', $body, $matches); |
|
400 | return [ |
|
401 | 'status' => 'error', |
|
402 | 'http_code' => $exception->getResponse()->getStatusCode(), |
|
403 | 'body' => $matches['1'], |
|
404 | ]; |
|
405 | } |
|
406 | } |
|
407 |