Skip to content

Commit

Permalink
small improvement around handling exceptions
Browse files Browse the repository at this point in the history
  • Loading branch information
dam-bal committed Apr 14, 2024
1 parent c1a9009 commit fdf947a
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/Client.php
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,8 @@ public function request(string $uri, string $method, array $options = []): Respo
$response = $this->client->request($method, $uri, $options);
} catch (ClientException $exception) {
$response = $exception->getResponse();
$body = json_decode($response->getBody()->getContents(), true, flags: JSON_THROW_ON_ERROR);

$body = $this->getResponseBody($response);

$code = $body['error']['code'] ?? 'unknown_error';
$message = $body['error']['message'] ?? null;
Expand Down

0 comments on commit fdf947a

Please sign in to comment.