Check if a cURL transfer resulted in what should be an exception
RequestInterface $request Request to check:
CurlHandle $handle Curl handle object:
array $curl Array returned from curl_multi_info_read:
\Exception|bool
private function isCurlException(RequestInterface $request, CurlHandle $handle, array $curl) {
if (CURLM_OK == $curl['result'] || CURLM_CALL_MULTI_PERFORM == $curl['result']) {
return false;
}
$handle
->setErrorNo($curl['result']);
$e = new CurlException(sprintf('[curl] %s: %s [url] %s [info] %s [debug] %s', $handle
->getErrorNo(), $handle
->getError(), $handle
->getUrl(), var_export($handle
->getInfo(), true), $handle
->getStderr()));
$e
->setCurlHandle($handle)
->setRequest($request)
->setError($handle
->getError(), $handle
->getErrorNo());
return $e;
}