Skip to content

Commit 80e0f9c

Browse files
Print CURL error message to the log (eclipse-leda#51)
1 parent 70df8c1 commit 80e0f9c

File tree

1 file changed

+8
-4
lines changed

1 file changed

+8
-4
lines changed

src/Download/Downloader.cpp

+8-4
Original file line numberDiff line numberDiff line change
@@ -165,7 +165,13 @@ namespace {
165165
curl_easy_setopt(h, CURLOPT_PROTOCOLS_STR, "https");
166166
CURLcode res = curl_easy_perform(h);
167167

168-
sua::Logger::debug("curl_easy_perform ended with code = '{}'", res);
168+
const auto curl_status_message = fmt::format("curl_easy_perform ended with code = {} ({})", res, curl_easy_strerror(res));
169+
170+
if(res == CURLE_OK) {
171+
sua::Logger::trace(curl_status_message);
172+
} else {
173+
sua::Logger::error(curl_status_message);
174+
}
169175

170176
long http_code = 0;
171177
curl_easy_getinfo(h, CURLINFO_RESPONSE_CODE, &http_code);
@@ -174,9 +180,7 @@ namespace {
174180

175181
sua::Logger::debug("CURLINFO_RESPONSE_CODE = {}", http_code);
176182
if(http_code != 200) {
177-
auto e = curl_easy_strerror(res);
178-
sua::Logger::error(e);
179-
return std::make_tuple(sua::TechCode::DownloadFailed, e);
183+
return std::make_tuple(sua::TechCode::DownloadFailed, curl_easy_strerror(res));
180184
}
181185

182186
return std::make_tuple(sua::TechCode::OK, "");

0 commit comments

Comments
 (0)