SpotifyApiBundle
SpotifyApiBundle copied to clipboard
Handling of negative responses
Hey there, nice library ;].
I was wondering what your thoughts are to use exceptions when negative responses are received. In my opinion this would lead to much cleaner code. So instead of:
$track = $this->get('spotify.api.lookup')->getTrack($spotifyUri);
if (is_array($track)) {
// handle error
} else {
// use track
}
You get:
try {
$track = $this->get('spotify.api.lookup')->getTrack($spotifyUri);
// use track
} catch (SpotifyException $e) {
// handle exception
}
Hmmm, interesting...
I'll work as soon as possible with this feature. You're right, this is something must be changed and managed as expected ( with exceptions )
If you want, feel free to contribute :D:D:D
@mmoreram thanks for the invitation. I'm using it in a pet project in which I don't put a lot of time. But we'll see who gets to this first ;].