From fdf947a76d26e19ea35d5160b1c0cf2840d3fb43 Mon Sep 17 00:00:00 2001 From: dam-bal Date: Sun, 14 Apr 2024 21:44:43 +0100 Subject: [PATCH] small improvement around handling exceptions --- src/Client.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/Client.php b/src/Client.php index 16c27af..15a5652 100644 --- a/src/Client.php +++ b/src/Client.php @@ -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;