Improve Errorhandling
This commit is contained in:
+17
-1
@@ -176,10 +176,14 @@ std::string HttpClientImpl::PerformOperation(const HttpRequest& request) const
|
||||
Logging::Log(Logging::Severity::Debug, debug.str());
|
||||
debug.str("");
|
||||
|
||||
CURLcode returnValue;
|
||||
long code = 0;
|
||||
curl_easy_perform(curl);
|
||||
|
||||
returnValue = curl_easy_perform(curl);
|
||||
curl_easy_getinfo(curl, CURLINFO_RESPONSE_CODE, &code);
|
||||
|
||||
if (CURLE_OK == returnValue)
|
||||
{
|
||||
if (returnType != HttpRequest::ReturnType::Code)
|
||||
{
|
||||
if (code < 100)
|
||||
@@ -261,6 +265,18 @@ std::string HttpClientImpl::PerformOperation(const HttpRequest& request) const
|
||||
if (m_debugLogging)
|
||||
Logging::Log(Logging::Severity::Debug, debug.str());
|
||||
debug.str("");
|
||||
}
|
||||
else if (CURLE_OPERATION_TIMEDOUT == returnValue)
|
||||
{
|
||||
std::stringstream err;
|
||||
err << "Timeout (" << m_timeout << " seconds) encountered while retrieving " << url << "\n";
|
||||
error = err.str();
|
||||
|
||||
debug << "Operation timed out" << std::endl;
|
||||
if (m_debugLogging)
|
||||
Logging::Log(Logging::Severity::Debug, debug.str());
|
||||
debug.str("");
|
||||
}
|
||||
|
||||
curl_easy_cleanup(curl);
|
||||
|
||||
|
||||
@@ -5,6 +5,7 @@
|
||||
LIBRARIES += Logging
|
||||
LIBRARIES += Utilities
|
||||
|
||||
CFLAGS += -Wno-deprecated-declarations
|
||||
CFLAGS += -I$(ROOTPATH)/Libraries/asio/include
|
||||
|
||||
LFLAGS += -pthread
|
||||
|
||||
Reference in New Issue
Block a user