[PR #142] [MERGED] Added helper functions to Exceptions for easier handling. #266

Closed
opened 2026-02-27 19:26:52 +03:00 by kerem · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/jwilsson/spotify-web-api-php/pull/142
Author: @doekenorg
Created: 11/5/2018
Status: Merged
Merged: 11/7/2018
Merged by: @jwilsson

Base: masterHead: add-auth-exception-helpers


📝 Commits (4)

  • c2c4036 Added helper functions to Exceptions for easier handling.
  • 4d8a23d Added some test coverage
  • 57bd605 Added more coverage. Must make tests pass!
  • b502e30 Change quotes

📊 Changes

3 files changed (+113 additions, -6 deletions)

View changed files

📝 src/SpotifyWebAPIAuthException.php (+24 -0)
📝 src/SpotifyWebAPIException.php (+10 -1)
📝 tests/RequestTest.php (+79 -5)

📄 Description

To help the ease of implementation of #137 I've added some helper functions to the exceptions themself.

It's split into the two exceptions, because they both are responsible for a different part. When requesting some info using an expired access token, the general exception is triggered. For the initial authorization flow the SpotifyWebAPIAuthException is thrown.

@jwilsson It was not so easy to get these error messages. I've had to generate some keys to check them later. As a result I'm not sure how we should put this under tests. If you have any ideas let me know, or be my guest 😄.

Edit: So I've tried adding some tests. I did need to change your setupStub function to also be able to throw exceptions as a result. If you have issues with them, please let me know. I'd love to learn some new tricks.


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/jwilsson/spotify-web-api-php/pull/142 **Author:** [@doekenorg](https://github.com/doekenorg) **Created:** 11/5/2018 **Status:** ✅ Merged **Merged:** 11/7/2018 **Merged by:** [@jwilsson](https://github.com/jwilsson) **Base:** `master` ← **Head:** `add-auth-exception-helpers` --- ### 📝 Commits (4) - [`c2c4036`](https://github.com/jwilsson/spotify-web-api-php/commit/c2c4036ee03c6e2dedc79310f29faf46e9d7c831) Added helper functions to Exceptions for easier handling. - [`4d8a23d`](https://github.com/jwilsson/spotify-web-api-php/commit/4d8a23db2a4cde9f4bcc6154c324972eb88fead9) Added some test coverage - [`57bd605`](https://github.com/jwilsson/spotify-web-api-php/commit/57bd60535db0ef4dcdd327026316310ff61928c1) Added more coverage. Must make tests pass! - [`b502e30`](https://github.com/jwilsson/spotify-web-api-php/commit/b502e300087c9dd536d307944d22e91da4481b79) Change quotes ### 📊 Changes **3 files changed** (+113 additions, -6 deletions) <details> <summary>View changed files</summary> 📝 `src/SpotifyWebAPIAuthException.php` (+24 -0) 📝 `src/SpotifyWebAPIException.php` (+10 -1) 📝 `tests/RequestTest.php` (+79 -5) </details> ### 📄 Description To help the ease of implementation of #137 I've added some helper functions to the exceptions themself. It's split into the two exceptions, because they both are responsible for a different part. When requesting some info using an expired access token, the general exception is triggered. For the initial authorization flow the `SpotifyWebAPIAuthException` is thrown. @jwilsson It was not so easy to get these error messages. I've had to generate some keys to check them later. As a result I'm not sure how we should put this under tests. If you have any ideas let me know, or be my guest 😄. Edit: So I've tried adding some tests. I did need to change your `setupStub` function to also be able to throw exceptions as a result. If you have issues with them, please let me know. I'd love to learn some new tricks. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
kerem 2026-02-27 19:26:52 +03:00
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#266
No description provided.