| @@ 460-469 (lines=10) @@ | ||
| 457 | * |
|
| 458 | * @return array |
|
| 459 | */ |
|
| 460 | private function clientError(\GuzzleHttp\Exception\ClientException $exception) |
|
| 461 | { |
|
| 462 | $body = (string) $exception->getResponse()->getBody(); |
|
| 463 | ||
| 464 | return [ |
|
| 465 | 'status' => 'error', |
|
| 466 | 'http_code' => $exception->getResponse()->getStatusCode(), |
|
| 467 | 'body' => json_decode($body), |
|
| 468 | ]; |
|
| 469 | } |
|
| 470 | ||
| 471 | /** |
|
| 472 | * Parse the java exception that we receive from Smartcall's Tomcat's. |
|
| @@ 478-487 (lines=10) @@ | ||
| 475 | * |
|
| 476 | * @return array |
|
| 477 | */ |
|
| 478 | private function parseError(\GuzzleHttp\Exception\ServerException $exception) |
|
| 479 | { |
|
| 480 | $body = (string) $exception->getResponse()->getBody(); |
|
| 481 | preg_match('!<p><b>type</b> Exception report</p><p><b>message</b> <u>(.*[^</u>])</u></p><p><b>description</b>!', $body, $matches); |
|
| 482 | return [ |
|
| 483 | 'status' => 'error', |
|
| 484 | 'http_code' => $exception->getResponse()->getStatusCode(), |
|
| 485 | 'body' => $matches['1'], |
|
| 486 | ]; |
|
| 487 | } |
|
| 488 | } |
|
| 489 | ||