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