Commit 5b90475e authored by tufengqi's avatar tufengqi

Merge branch 'TRADE-501' into 'master'

fix Closes TRADE-501 See merge request !7
parents 7343b717 55cd2b58
......@@ -170,6 +170,7 @@ class CurlHttpClient
curl_close($this->curl_handle);
$this->curl_handle = null;
$error = 'CurlHttpClient: Could not connect to ' . $full_url;
\Yii::$app->fpf->error('http', curl_errno($this->curl_handle), __CLASS__, __FUNCTION__, ' ERROR:' .$error);
throw new CurlHttpException($error, CurlHttpException::NOT_OPEN);
}
}
......
......@@ -38,6 +38,11 @@ class SwooleHttpClient
protected $connect_timeout_ms;
protected $timeout_ms;
protected $method;
/**
* Http 客户端
*
* @var Client
*/
protected $curl_handle;
protected $response;
protected $cookies = [];
......@@ -157,6 +162,7 @@ class SwooleHttpClient
if (!$this->response) {
$this->curl_handle = null;
$error = 'CurlHttpClient: Could not connect to ' . $full_url;
\Yii::$app->fpf->error('http', $this->curl_handle->errCode, __CLASS__, __FUNCTION__, ' ERROR:' .$error);
throw new SwooleHttpException($error, SwooleHttpException::NOT_OPEN);
}
}
......
......@@ -228,6 +228,7 @@ class SwooleHttpClient extends \Thrift\Transport\TTransport
// Connect failed?
if (!$this->response_) {
$error = 'SwooleHttpClient: Could not connect to ' . $this->scheme_ . "://" . $host . $this->uri_;
\Yii::$app->fpf->error('http', $this->handle->errCode, __CLASS__, __FUNCTION__, ' ERROR:' .$error);
throw new TTransportException($error, TTransportException::NOT_OPEN);
}
}
......
......@@ -237,6 +237,7 @@ class TCurlClient extends \Thrift\Transport\TTransport
curl_close($this->handle);
$this->handle = null;
$error = 'TCurlClient: Could not connect to ' . $full_url;
\Yii::$app->fpf->error('http', curl_errno($this->handle), __CLASS__, __FUNCTION__, ' ERROR:' .$error);
throw new TTransportException($error, TTransportException::NOT_OPEN);
}
}
......
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