Skip to content
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

document when exception is thrown #82

Closed
dbu opened this issue Nov 12, 2015 · 6 comments
Closed

document when exception is thrown #82

dbu opened this issue Nov 12, 2015 · 6 comments

Comments

@dbu
Copy link
Contributor

dbu commented Nov 12, 2015

as discussed in php-http/documentation#30, we seem to only throw an exception when there is no response object available.

Exception in this case is more when connection or transfer, parsing failed. Here it transform response who was correctly received but has a status code between 400 and 599 (the status code list where it throws exception can be changed by configuring the plugin)

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?)

@sagikazarmark
Copy link
Member

I would not bring the error plugin here. Otherwise, I agree.

@joelwurtz
Copy link
Member

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)

@sagikazarmark
Copy link
Member

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.

@dbu
Copy link
Contributor Author

dbu commented Nov 12, 2015

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?

@sagikazarmark
Copy link
Member

Actually, I don't mind mentioning the error plugin, but it is some sort of coupling to an implementation which feels weird IMHO.

@sagikazarmark
Copy link
Member

Can this be closed in favor of #87 ?

Nyholm added a commit to Nyholm/httplug that referenced this issue Dec 26, 2019
Allow CURL constant names and validate we found them
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants