| @@ 270-279 (lines=10) @@ | ||
| 267 | * |
|
| 268 | * @return array |
|
| 269 | */ |
|
| 270 | private function clientError(\GuzzleHttp\Exception\ClientException $exception) |
|
| 271 | { |
|
| 272 | $body = (string) $exception->getResponse()->getBody(); |
|
| 273 | ||
| 274 | return [ |
|
| 275 | 'status' => 'error', |
|
| 276 | 'http_code' => $exception->getResponse()->getStatusCode(), |
|
| 277 | 'body' => json_decode($body), |
|
| 278 | ]; |
|
| 279 | } |
|
| 280 | ||
| 281 | /** |
|
| 282 | * Parse the java exception that we receive from Smartcall's Tomcat's. |
|
| @@ 288-297 (lines=10) @@ | ||
| 285 | * |
|
| 286 | * @return array |
|
| 287 | */ |
|
| 288 | private function parseError(\GuzzleHttp\Exception\ServerException $exception) |
|
| 289 | { |
|
| 290 | $body = (string) $exception->getResponse()->getBody(); |
|
| 291 | preg_match('!<p><b>type</b> Exception report</p><p><b>message</b> <u>(.*[^</u>])</u></p><p><b>description</b>!', $body, $matches); |
|
| 292 | return [ |
|
| 293 | 'status' => 'error', |
|
| 294 | 'http_code' => $exception->getResponse()->getStatusCode(), |
|
| 295 | 'body' => $matches['1'], |
|
| 296 | ]; |
|
| 297 | } |
|
| 298 | } |
|
| 299 | ||