-
Notifications
You must be signed in to change notification settings - Fork 39
PSR-18: Network / Request exception inheritance #158
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
Conversation
a2eab31
to
e729f61
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.
thanks! can you do the 2 phpdoc tweaks please?
Could we really merge this? Isnt this considered a BC break. Also, the current implementation is not a violation on PSR-18 if I recall correctly. |
@Nyholm did you see the motivation in #155 for this? i think it is indeed quite unexpected that catching the RequestExceptionInterface will hide NetworkExceptionInterface and you would need to order the catches inverse if you want to separate them. both exceptions still extend ClientExceptionInterface, which would be the thing to catch/typehint if you mean both exceptions. i agree that this might trip up somebody in some way, but consider it a design bug with potential for BC breaks if users have relied on the bug. there is however a real risk of psr-18 consuming applications not working as expected when using httplug as it is now, with the mixed-up exceptions. my suggestion is to do a new minor version rather than a patch release and document it in the changelog. do you think that is not strict enough? |
Well, all bug fixes are BC breaks by their very nature. Usually a breaking change is defined as a BC break that is not bug fix. :) |
Well, this is kind of an interesting "incompatibility" between the HTTPlug and PSR design ideas. Ideally, there should always be at least a Those who specifically want to handle So I think we can classify this as a bug and fix it accordingly. |
imho the correct thing for PSR users to catch all client exceptions is to catch |
@Nyholm okay if i merge this for a 2.1 release, or do you still object? |
haha, of course this broke the httplug library that i maintain: FriendsOfSymfony/FOSHttpCache#474 :-/ (because i misunderstood the exceptions of httplug when writing that code) |
What's in this PR?
Http\Client\Exception\NetworkException
no longer extendsHttp\Client\Exception\RequestException
Http\Client\Exception\NetworkException
now extendsHttp\Client\Exception\TransferException
Http\Client\Exception\NetworkException
andHttp\Client\Exception\RequestException
both useHttp\Client\Exception\RequestAwareTrait
(not sure if this is the best approach?)Example Usage
Checklist