From 671d3ed0566e89daa481b83e7bd840849b4b8826 Mon Sep 17 00:00:00 2001 From: Sude Date: Mon, 6 Apr 2015 16:16:26 +0300 Subject: [PATCH] Show url for http error messages --- src/api.cpp | 4 ++-- src/downloader.cpp | 8 ++++---- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/api.cpp b/src/api.cpp index 99881d6..d8b6eb8 100644 --- a/src/api.cpp +++ b/src/api.cpp @@ -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(curl_easy_strerror(result))); + this->setError("HTTP ERROR: failed to get error code: " + static_cast(curl_easy_strerror(result)) + " (" + url + ")"); #ifdef DEBUG curl_easy_setopt(curlhandle, CURLOPT_FAILONERROR, false); diff --git a/src/downloader.cpp b/src/downloader.cpp index 30e993e..14d6c57 100644 --- a/src/downloader.cpp +++ b/src/downloader.cpp @@ -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; } }