From 94d7c707270672fbbd143c7d318f554d13603775 Mon Sep 17 00:00:00 2001 From: Andrew Belt Date: Sun, 27 Jun 2021 16:16:54 -0400 Subject: [PATCH] Add logging when network::requestJson() fails. --- src/network.cpp | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/network.cpp b/src/network.cpp index e1ea5f26..ab384410 100644 --- a/src/network.cpp +++ b/src/network.cpp @@ -127,7 +127,7 @@ json_t* requestJson(Method method, const std::string& url, json_t* dataJ, const curl_easy_setopt(curl, CURLOPT_WRITEDATA, &resText); // Perform request - INFO("Requesting %s %s", methodNames[method].c_str(), urlS.c_str()); + INFO("Requesting JSON: %s %s", methodNames[method].c_str(), urlS.c_str()); CURLcode res = curl_easy_perform(curl); // Cleanup @@ -136,8 +136,10 @@ json_t* requestJson(Method method, const std::string& url, json_t* dataJ, const curl_easy_cleanup(curl); curl_slist_free_all(headers); - if (res != CURLE_OK) + if (res != CURLE_OK) { + WARN("libcurl error: %s", curl_easy_strerror(res)); return NULL; + } // Parse JSON response json_error_t error; @@ -179,7 +181,7 @@ bool requestDownload(const std::string& url, const std::string& filename, float* curl_easy_setopt(curl, CURLOPT_COOKIE, getCookieString(cookies).c_str()); } - INFO("Downloading %s", url.c_str()); + INFO("Requesting download: %s", url.c_str()); CURLcode res = curl_easy_perform(curl); curl_easy_cleanup(curl);