Skip to content
This repository has been archived by the owner on Nov 2, 2023. It is now read-only.

Commit

Permalink
chore: add more details to error log
Browse files Browse the repository at this point in the history
  • Loading branch information
stefanorosanelli committed Jul 6, 2023
1 parent d7fe3fa commit c1b01b7
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/Client/ChatlasClient.php
Original file line number Diff line number Diff line change
Expand Up @@ -177,11 +177,13 @@ protected function apiRequest(array $options): array
try {
$response = $this->sendRequest($options);
$statusCode = $response->getStatusCode();
$body = (array)$response->getJson();
if ($statusCode >= 400) {
throw new HttpException('Chatlas API error', $statusCode);
$msg = sprintf('Chatlas API error [%d] - %s', $statusCode, json_encode($body));
throw new HttpException($msg);
}

return (array)$response->getJson();
return $body;
} catch (Throwable $e) {
return $this->handleError($e);
}
Expand Down

0 comments on commit c1b01b7

Please sign in to comment.