Rename HttpException to ClientException#909
Merged
jtojnar merged 13 commits intosimplepie:masterfrom Jun 25, 2025
Merged
Conversation
if the server responses with a status code 500
jtojnar
reviewed
Mar 15, 2025
adds a webserver mock for integration tests
Contributor
Author
|
I've added an integration test with a mocked webserver using https://github.com/donatj/mock-webserver. @jtojnar As you correctly said here we can check in the |
jtojnar
reviewed
Jun 25, 2025
use Mock instead of stub to make sure the get_status_code() method is called
jtojnar
approved these changes
Jun 25, 2025
Member
jtojnar
left a comment
There was a problem hiding this comment.
Looks perfect now. Suggest squash-merging with the following message:
Rename HttpException to ClientException and stop throwing on HTTP error in FileClient
This PR renames the `SimplePie\Exception\HttpException` to `SimplePie\HTTP\ClientException` to avoid confusion (https://github.com/simplepie/simplepie/pull/905) that this exception is thrown on an 4xx or 5xx response from the server. Because the `ClientException` is always caught internally, I marked the class as `@internal`.
Additionally, change the `FileClient` to only throw the exception on non-HTTP errors to match PSR-18 and our `Psr18Client`. This is not a BC break since this API is not part of any release yet.
Also add unit tests to show that the responses (`File` or `Psr7Response` class) always contain the status code, even if it is 429. Plus integration tests using a HTTP server.
Contributor
Author
|
👍 Please proceed as you like. |
Alkarex
added a commit
to Alkarex/simplepie
that referenced
this pull request
Aug 1, 2025
Finalise merge, following: * simplepie#905 (comment) * simplepie#909 * FreshRSS/FreshRSS#7038
Alkarex
added a commit
to Alkarex/FreshRSS
that referenced
this pull request
Aug 1, 2025
* FreshRSS/simplepie#47 Finalise merge, following: * simplepie/simplepie#905 (comment) * simplepie/simplepie#909 * FreshRSS#7038
This was referenced Aug 1, 2025
Alkarex
added a commit
to FreshRSS/FreshRSS
that referenced
this pull request
Aug 1, 2025
* Bump SimplePie with PHPStan Level 8 * FreshRSS/simplepie#45 SimplePie increased to PHPStan Level 8: * simplepie/simplepie#857 * Merge upstream Including my two PRs: * simplepie/simplepie#932 * simplepie/simplepie#933 * Resolve upstream sync of Expose HTTP status * FreshRSS/simplepie#47 Finalise merge, following: * simplepie/simplepie#905 (comment) * simplepie/simplepie#909 * #7038
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This PR renames the
SimplePie\Exception\HttpExceptiontoSimplePie\HTTP\ClientExceptionto avoid confusion (#905) that this exception is thrown on an 4xx or 5xx response from the server. Because theClientExceptionis always catched internally I marked the class as@internal.This PR also adds tests to show that the responses (
FileorPsr7Responseclass) always contains the status code, even if it is 429.