[GH-ISSUE #155] Access to "reason" in SpotifyWebAPIException when working with player #98

Closed
opened 2026-02-27 19:26:02 +03:00 by kerem · 1 comment
Owner

Originally created by @mengidd on GitHub (May 30, 2019).
Original GitHub issue: https://github.com/jwilsson/spotify-web-api-php/issues/155

When working with the player and Spotify returns an error, a reason string is included in the response. It would be super handy to get access to this reason string through the SpotifyWebAPIException exception, with for instance $e->getReason(). This would make it much easier to deal with the different errors.

The reason string is available in the response body with the key reason on player errors.

If this is something you might consider I don't mind submitting a PR for it.

Originally created by @mengidd on GitHub (May 30, 2019). Original GitHub issue: https://github.com/jwilsson/spotify-web-api-php/issues/155 When working with the [player](https://developer.spotify.com/documentation/web-api/reference/player/) and Spotify returns an error, a [reason string](https://developer.spotify.com/documentation/web-api/reference/object-model/#player-error-reasons) is included in the response. It would be super handy to get access to this reason string through the SpotifyWebAPIException exception, with for instance `$e->getReason()`. This would make it much easier to deal with the different errors. The reason string is available in the response body with the key `reason` on player errors. If this is something you might consider I don't mind submitting a PR for it.
kerem 2026-02-27 19:26:02 +03:00
Author
Owner

@jwilsson commented on GitHub (May 31, 2019):

Cool, I didn't know about that property!

A PR adding a getReason method would be highly appreciated!

<!-- gh-comment-id:497736073 --> @jwilsson commented on GitHub (May 31, 2019): Cool, I didn't know about that property! A PR adding a `getReason` method would be highly appreciated!
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/spotify-web-api-php#98
No description provided.