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

Commit

Permalink
Merge pull request #2 from atlasconsulting/chore/log-details
Browse files Browse the repository at this point in the history
Add more details to error log
  • Loading branch information
stefanorosanelli authored Jul 6, 2023
2 parents d7fe3fa + c1b01b7 commit ca464db
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 ca464db

Please sign in to comment.