@@ 442-451 (lines=10) @@ | ||
439 | * |
|
440 | * @return array |
|
441 | */ |
|
442 | private function clientError(\GuzzleHttp\Exception\ClientException $exception) |
|
443 | { |
|
444 | $body = (string) $exception->getResponse()->getBody(); |
|
445 | ||
446 | return [ |
|
447 | 'status' => 'error', |
|
448 | 'http_code' => $exception->getResponse()->getStatusCode(), |
|
449 | 'body' => json_decode($body), |
|
450 | ]; |
|
451 | } |
|
452 | ||
453 | /** |
|
454 | * Parse the java exception that we receive from Smartcall's Tomcat's. |
|
@@ 460-469 (lines=10) @@ | ||
457 | * |
|
458 | * @return array |
|
459 | */ |
|
460 | private function parseError(\GuzzleHttp\Exception\ServerException $exception) |
|
461 | { |
|
462 | $body = (string) $exception->getResponse()->getBody(); |
|
463 | preg_match('!<p><b>type</b> Exception report</p><p><b>message</b> <u>(.*[^</u>])</u></p><p><b>description</b>!', $body, $matches); |
|
464 | return [ |
|
465 | 'status' => 'error', |
|
466 | 'http_code' => $exception->getResponse()->getStatusCode(), |
|
467 | 'body' => $matches['1'], |
|
468 | ]; |
|
469 | } |
|
470 | ||
471 | /** |
|
472 | * Use basic authentication header content if bearer token is not set. |