Commit 76900b35 authored by Bas de Nooijer's avatar Bas de Nooijer

Added curl_error output to HTTP exception in the Curl handler

parent 1ad04795
...@@ -120,8 +120,8 @@ class Curl extends Configurable implements AdapterInterface ...@@ -120,8 +120,8 @@ class Curl extends Configurable implements AdapterInterface
$data = ''; $data = '';
} }
$this->check($data, $headers, $handle);
curl_close($handle); curl_close($handle);
$this->check($data, $headers);
return new Response($data, $headers); return new Response($data, $headers);
// @codeCoverageIgnoreEnd // @codeCoverageIgnoreEnd
...@@ -219,14 +219,15 @@ class Curl extends Configurable implements AdapterInterface ...@@ -219,14 +219,15 @@ class Curl extends Configurable implements AdapterInterface
* @throws HttpException * @throws HttpException
* @param string $data * @param string $data
* @param array $headers * @param array $headers
* @param Curl handle $handle
* @return void * @return void
*/ */
public function check($data, $headers) public function check($data, $headers, $handle)
{ {
// if there is no data and there are no headers it's a total failure, // if there is no data and there are no headers it's a total failure,
// a connection to the host was impossible. // a connection to the host was impossible.
if (empty($data) && count($headers) == 0) { if (empty($data) && count($headers) == 0) {
throw new HttpException("HTTP request failed"); throw new HttpException('HTTP request failed, '.curl_error($handle));
} }
} }
} }
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment