diff --git a/src/SpotifyRequest.php b/src/SpotifyRequest.php index 581e761..71377f5 100644 --- a/src/SpotifyRequest.php +++ b/src/SpotifyRequest.php @@ -36,9 +36,9 @@ public function get(string $endpoint, array $params = []): array ], ]); } catch (RequestException $e) { - $errorResponse = json_decode($e->getResponse()->getBody()->getContents()); - $status = $errorResponse->error->status; - $message = $errorResponse->error->message; + $errorResponse = $e->getResponse(); + $status = $errorResponse->getStatusCode();; + $message = $errorResponse->getReasonPhrase(); throw new SpotifyApiException($message, $status, $errorResponse); }