Show url for http error messages

This commit is contained in:
Sude 2015-04-06 16:16:26 +03:00
parent 2fc7fa88a7
commit 671d3ed056
2 changed files with 6 additions and 6 deletions

View File

@ -239,9 +239,9 @@ std::string API::getResponse(const std::string& url)
long int response_code = 0;
result = curl_easy_getinfo(curlhandle, CURLINFO_RESPONSE_CODE, &response_code);
if (result == CURLE_OK)
this->setError("HTTP ERROR: " + std::to_string(response_code));
this->setError("HTTP ERROR: " + std::to_string(response_code) + " (" + url + ")");
else
this->setError("HTTP ERROR: failed to get error code: " + static_cast<std::string>(curl_easy_strerror(result)));
this->setError("HTTP ERROR: failed to get error code: " + static_cast<std::string>(curl_easy_strerror(result)) + " (" + url + ")");
#ifdef DEBUG
curl_easy_setopt(curlhandle, CURLOPT_FAILONERROR, false);

View File

@ -1625,9 +1625,9 @@ int Downloader::downloadCovers(const std::string& gamename, const std::string& d
result = curl_easy_getinfo(curlhandle, CURLINFO_RESPONSE_CODE, &response_code);
std::cout << "HTTP ERROR: ";
if (result == CURLE_OK)
std::cout << response_code << std::endl;
std::cout << response_code << " (" << cover_url << ")" << std::endl;
else
std::cout << "failed to get error code: " << curl_easy_strerror(result) << std::endl;
std::cout << "failed to get error code: " << curl_easy_strerror(result) << " (" << cover_url << ")" << std::endl;
}
coverNode = gameNode->IterateChildren(coverNode);
@ -1683,9 +1683,9 @@ std::string Downloader::getResponse(const std::string& url)
result = curl_easy_getinfo(curlhandle, CURLINFO_RESPONSE_CODE, &response_code);
std::cout << "HTTP ERROR: ";
if (result == CURLE_OK)
std::cout << response_code << std::endl;
std::cout << response_code << " (" << url << ")" << std::endl;
else
std::cout << "failed to get error code: " << curl_easy_strerror(result) << std::endl;
std::cout << "failed to get error code: " << curl_easy_strerror(result) << " (" << url << ")" << std::endl;
}
}