Closed dbu closed 8 years ago
I would not bring the error plugin here. Otherwise, I agree.
There may be case where you have an exception and a response, like you received all the status code and the headers, but connection was interrupted when receiving the body of the response. (So you have a response, which is incomplete, but can always be used for debugging purpose)
I would say in this case you don't have a response and should be a network error returned.
Longer answer: you cannot return a complete Response object.
i guess it depends on the client what kind of exception it throws in that case. but an exception must will be thrown as there won't be a HTTP status code in the response for this situation.
why not mention the error plugin?
Actually, I don't mind mentioning the error plugin, but it is some sort of coupling to an implementation which feels weird IMHO.
Can this be closed in favor of #87 ?
as discussed in https://github.com/php-http/documentation/pull/30/, we seem to only throw an exception when there is no response object available.
i guess that is what we agreed on, but if that is correct, we should update the phpdoc of Client to say when exceptions are thrown (basically if no response is available due to errors in the networking, or if the client decides to throw an exception for other reasons... maybe we should just mention the error plugin to make this more concrete. would that make sense?)