You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Currently, when I set curl timeout options, and a request through pest times out, a Pest_UnknownResponse will be throw. This is because the "http_code" in $meta is 0.
Would it be nice for Pest to support discovering timeouts as a special kind of error?
Currently, the exceptions thrown map to HTTP responses, and for a REST api, that seems to be as it should. But working with pest and timeouts require all pest calls to be wrapped in "Pest_UnknownResponse" catches, where each catch then tries to discover if request took more than timeout seconds.
What are your thoughts on this?
The text was updated successfully, but these errors were encountered:
I should say though that (fortunately) I don't have to write much PHP nowadays, so maintaining Pest is a pretty low priority for me. I should probably look into getting someone to take over maintenance...
Would be easy to add now if pull #42 gets merged.
With it CURLOPT_TIMEOUT sets curl_exec to fail and then you can catch Pest_Curl_Exec exception with curl_error() for timeout. I kind of wanted to limit this purely to errnos but existing library already was relying on error messages instead of errors so wanted to keep it consistent where supported (f.ex. PHP JSON has only later version support for error messages instead of pure errno's)
Could add this in next pull as separate exception though..? What speaks (just small little bit..) against this is the fact that we expose curl already directly settings wise (ugly IMHO) in non-documented manner (because people need it) so it would be more consistent to let the developer handle curl errors that we pass with the exception.. ?
Overall I kind of hate the processError() thing and could add processErrno($errno, $layer) instead e.g. processErrno(29, 'curl') would get timeout processed addition to exception perhaps... errnos are better as matches as well.. though separate exceptions are always best as long as you can keep up with them...
Currently, when I set curl timeout options, and a request through pest times out, a Pest_UnknownResponse will be throw. This is because the "http_code" in $meta is 0.
Would it be nice for Pest to support discovering timeouts as a special kind of error?
Currently, the exceptions thrown map to HTTP responses, and for a REST api, that seems to be as it should. But working with pest and timeouts require all pest calls to be wrapped in "Pest_UnknownResponse" catches, where each catch then tries to discover if request took more than timeout seconds.
What are your thoughts on this?
The text was updated successfully, but these errors were encountered: