aerni/laravel-spotify

Error Handling Throws New Error

syclone opened this issue · 3 comments

Errors are not being handled correctly. When an error occurs with the API, this package creates another error instead of logging or presenting the API error.

ErrorException: Attempt to read property "error" on null in /var/www/html/vendor/aerni/laravel-spotify/src/SpotifyRequest.php:40

We don't know what Spotify API complained about, as the error was not handled.

Thanks for sharing this package.

aerni commented

Does PR #41 resolve your issue? I'm happy to merge the changes if you confirm that it resolves your problem.

Maybe... I am going to test it and let you know soon.

Hello @aerni ,

Yes, that PR #41 fixed my issue. I am now getting the Spotify API error message instead of the "property error on null".

For example, now I see :

Too Many Requests {"exception":"[object] (Aerni\\Spotify\\Exceptions\\SpotifyApiException(code: 429): Too Many Requests at /var/www/html/vendor/aerni/laravel-spotify/src/SpotifyRequest.php:43)
[stacktrace]

Which I expected since I tried to hit my throttle limit.

I will be updating my version as soon as you merge it. Thanks