Closed joeygallegos closed 9 months ago
Hey!
I totally agree, looks like the Spotify docs doesn't reflect reality. The endpoint returns a HTTP 204 with an empty body when nothing is playing which of course will cause null
to be returned.
I'll update the function declaration to reflect this and I've posted on Spotify's developer forum asking them to update the docs.
And updated function declarations are available in 6.0.2
.
@jwilsson many thanks for fixing the issue! I tried again with the new version, and the issue is resolved. Working as expected.
I am writing an application that tracks what song I am currently listening to. When I stop playing music and exit the desktop app, I get the below TypeError exception because the API is returning a null response but the function is declared to only allow
array|object
as return types. Right now, when I wrap the code in a try/catch, it doesn't even run the caught exception. When playing music, I get no error.Exception:
I have my code setup like this:
Composer version:
Expectation: Ideally, when SpotifyAPI returns null because the player is fully exited and the music isn't technically "paused" or "playing", then I should be allowed to check
getMyCurrentTrack()
for null value(s) and handle my code based around that.