Skip to content

Commit 51196ff

Browse files
committed
Show download error message
1 parent b745f30 commit 51196ff

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

src/s25update.cpp

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ class EasyCurl
8989
curl_easy_setopt(h_, option, value); //-V111
9090
}
9191

92-
bool perform() { return curl_easy_perform(h_) == 0; }
92+
CURLcode perform() { return curl_easy_perform(h_); }
9393

9494
std::optional<std::string> escape(const std::string& s) const
9595
{
@@ -235,7 +235,11 @@ bool DoDownloadFile(const std::string& url, const std::variant<std::string*, bfs
235235
curl.setOpt(CURLOPT_WRITEDATA, static_cast<void*>(memory));
236236
}
237237

238-
return curl.perform();
238+
const auto res = curl.perform();
239+
if(res == CURLE_OK)
240+
return true;
241+
bnw::cerr << "Download error: " << curl_easy_strerror(res) << '\n';
242+
return false;
239243
}
240244

241245
bool DownloadFile(const std::string& url, const bfs::path& path, std::string progress = "")

0 commit comments

Comments
 (0)