[HttpClient] display proper error message on TransportException when curl is used
This commit is contained in:
parent
1cd99eaaa8
commit
3273109cbe
@ -27,7 +27,7 @@ trait HttpExceptionTrait
|
|||||||
$this->response = $response;
|
$this->response = $response;
|
||||||
$code = $response->getInfo('http_code');
|
$code = $response->getInfo('http_code');
|
||||||
$url = $response->getInfo('url');
|
$url = $response->getInfo('url');
|
||||||
$message = sprintf('HTTP %d returned for URL "%s".', $code, $url);
|
$message = sprintf('HTTP %d returned for "%s".', $code, $url);
|
||||||
|
|
||||||
$httpCodeFound = false;
|
$httpCodeFound = false;
|
||||||
$isJson = false;
|
$isJson = false;
|
||||||
@ -37,7 +37,7 @@ trait HttpExceptionTrait
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
$message = sprintf('%s returned for URL "%s".', $h, $url);
|
$message = sprintf('%s returned for "%s".', $h, $url);
|
||||||
$httpCodeFound = true;
|
$httpCodeFound = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -245,7 +245,7 @@ final class CurlResponse implements ResponseInterface
|
|||||||
|
|
||||||
while ($info = curl_multi_info_read($multi->handle)) {
|
while ($info = curl_multi_info_read($multi->handle)) {
|
||||||
$multi->handlesActivity[(int) $info['handle']][] = null;
|
$multi->handlesActivity[(int) $info['handle']][] = null;
|
||||||
$multi->handlesActivity[(int) $info['handle']][] = \in_array($info['result'], [\CURLE_OK, \CURLE_TOO_MANY_REDIRECTS], true) || (\CURLE_WRITE_ERROR === $info['result'] && 'destruct' === @curl_getinfo($info['handle'], CURLINFO_PRIVATE)) ? null : new TransportException(curl_error($info['handle']));
|
$multi->handlesActivity[(int) $info['handle']][] = \in_array($info['result'], [\CURLE_OK, \CURLE_TOO_MANY_REDIRECTS], true) || (\CURLE_WRITE_ERROR === $info['result'] && 'destruct' === @curl_getinfo($info['handle'], CURLINFO_PRIVATE)) ? null : new TransportException(sprintf('%s for"%s".', curl_strerror($info['result']), curl_getinfo($info['handle'], CURLINFO_EFFECTIVE_URL)));
|
||||||
}
|
}
|
||||||
} finally {
|
} finally {
|
||||||
self::$performing = false;
|
self::$performing = false;
|
||||||
|
Reference in New Issue
Block a user