Skip to content

Commit e99aa73

Browse files
committed
expose the libcurl detail error messages.
1 parent 6cc1d4e commit e99aa73

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

sdk/src/http/CurlHttpClient.cc

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -541,6 +541,11 @@ std::shared_ptr<HttpResponse> CurlHttpClient::makeRequest(const std::shared_ptr<
541541
curl_easy_setopt(curl, CURLOPT_DEBUGFUNCTION, debugCallback);
542542
}
543543

544+
//Error Buffer
545+
char errbuf[CURL_ERROR_SIZE];
546+
curl_easy_setopt(curl, CURLOPT_ERRORBUFFER, errbuf);
547+
errbuf[0] = 0;
548+
544549
//progress Callback
545550
curl_easy_setopt(curl, CURLOPT_PROGRESSFUNCTION, progressCallback);
546551
curl_easy_setopt(curl, CURLOPT_PROGRESSDATA, &transferState);
@@ -587,7 +592,11 @@ std::shared_ptr<HttpResponse> CurlHttpClient::makeRequest(const std::shared_ptr<
587592
}
588593
break;
589594
default:
590-
response->setStatusMsg(curl_easy_strerror(res));
595+
{
596+
std::string msg(curl_easy_strerror(res));
597+
msg.append(".").append(errbuf);
598+
response->setStatusMsg(msg);
599+
}
591600
break;
592601
};
593602
}

0 commit comments

Comments
 (0)