-
-
Notifications
You must be signed in to change notification settings - Fork 2.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
PSR-18: Separate ConnectException from RequestException #2541
Conversation
c3b4a6e
to
a1c629e
Compare
a1c629e
to
7b2946d
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I am not sure about the traits.. because the functions are pretty simple.. besides that in general I agree that separating the exceptions is a necessary evil step that we need to apply towards 7.0 and supporting PSR-18
@gmponos I can remove use of traits if preferable? I was also wondering if the following methods could be removed with a note added to
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you for this PR.
I agree with this change.
Could you please remove the Traits?
Could you also remove the hasResponse()
and getResponse()
from the ConnectException.
Would you prefer the PHPDoc for |
You can duplicate it. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we update changelog as well.. In general I am happy with it.
Generally, change log updates should not be done in a PR. That will lead to merge conflicts. |
With these changes, we should also change RequestException to make the response non-optional. The response was only optional for ConnectException. But now ConnectException does not extend RequestException anymore. All sub-classes of RequestException have a response now AFAIK. |
Looks like TooManyRedirectsException does not have a response but should have. The response is just not forwarded from what I see. |
Thank you @Tobion |
The docs haven't been updated and still display the old hiearchy: https://docs.guzzlephp.org/en/stable/quickstart.html#exceptions |
As of Guzzle 7.0.0, ConnectException was moved under TransferException from RequestException. Guzzle docs to not properly reflect this. Guzzle change: guzzle/guzzle#2541 In the case of a ConnectException being thrown, this would cause another exception.
Guzzle version affected:
7.0.0-beta.1
Relates to #2507 / php-http/httplug#155
Description
Update exception hierarchy to conform with https://www.php-fig.org/psr/psr-18/meta/
Changed
ConnectException
now extendsTransferException
instead ofRequestException
New hierarchy:
I've tried to do this with as few breaking changes as possible - you could instead introduce a new exception that implements
Psr\Http\Client\RequestExceptionInterface
which would extendRequestException
like this (which would be non-breaking):