Skip to content

Commit 50de3e6

Browse files
committed
Improved client/server response exception messages
1 parent 142327b commit 50de3e6

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/Response/Elasticsearch.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -63,13 +63,13 @@ public function setResponse(ResponseInterface $response, bool $throwException =
6363
$status = $response->getStatusCode();
6464
if ($throwException && $status > 399 && $status < 500) {
6565
$error = new ClientResponseException(
66-
sprintf("%s %s", $status, $response->getReasonPhrase()),
66+
sprintf("%s %s: %s", $status, $response->getReasonPhrase(), (string) $response->getBody()),
6767
$status
6868
);
6969
throw $error->setResponse($response);
7070
} elseif ($throwException && $status > 499 && $status < 600) {
7171
$error = new ServerResponseException(
72-
sprintf("%s %s", $status, $response->getReasonPhrase()),
72+
sprintf("%s %s: %s", $status, $response->getReasonPhrase(), (string) $response->getBody()),
7373
$status
7474
);
7575
throw $error->setResponse($response);

0 commit comments

Comments
 (0)