[
https://issues.apache.org/jira/browse/THRIFT-4645?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16637394#comment-16637394
]
ASF GitHub Bot commented on THRIFT-4645:
----------------------------------------
jeking3 closed pull request #1602: THRIFT-4645: TCurlClient: include failure
reason in exception
URL: https://github.com/apache/thrift/pull/1602
This is a PR merged from a forked repository.
As GitHub hides the original diff on merge, it is displayed below for
the sake of provenance:
As this is a foreign pull request (from a fork), the diff is supplied
below (as it won't show otherwise due to GitHub magic):
diff --git a/lib/php/lib/Transport/TCurlClient.php
b/lib/php/lib/Transport/TCurlClient.php
index 2ca4f65bb0..3d4908d901 100644
--- a/lib/php/lib/Transport/TCurlClient.php
+++ b/lib/php/lib/Transport/TCurlClient.php
@@ -219,15 +219,19 @@ public function flush()
curl_setopt(self::$curlHandle, CURLOPT_URL, $fullUrl);
$this->response_ = curl_exec(self::$curlHandle);
+ $responseError = curl_error(self::$curlHandle);
$code = curl_getinfo(self::$curlHandle, CURLINFO_HTTP_CODE);
// Handle non 200 status code / connect failure
- if (!$this->response_ || $code !== 200) {
+ if ($this->response_ === false || $code !== 200) {
curl_close(self::$curlHandle);
self::$curlHandle = null;
$this->response_ = null;
$error = 'TCurlClient: Could not connect to ' . $fullUrl;
+ if ($responseError) {
+ $error .= ', ' . $responseError;
+ }
if ($code) {
$error .= ', HTTP status code: ' . $code;
}
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]
> TCurlClient: show actual error message when throwing TTransportException
> ------------------------------------------------------------------------
>
> Key: THRIFT-4645
> URL: https://issues.apache.org/jira/browse/THRIFT-4645
> Project: Thrift
> Issue Type: Improvement
> Components: PHP - Library
> Reporter: James Johnston
> Priority: Minor
> Labels: pull-request-available
> Fix For: 0.12.0
>
>
> The TCurlClient does not create a very informative error message when
> throwing TTransportException. In particular, the PHP "curl_error" function
> is a valuable source of information when "curl_exec" fails, and I think it
> would be highly useful to include that message when throwing
> TTransportException.
--
This message was sent by Atlassian JIRA
(v7.6.3#76005)