Skip to content

Commit

Permalink
Show download error message
Browse files Browse the repository at this point in the history
  • Loading branch information
Flamefire committed Jan 1, 2025
1 parent b745f30 commit 51196ff
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions src/s25update.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ class EasyCurl
curl_easy_setopt(h_, option, value); //-V111
}

bool perform() { return curl_easy_perform(h_) == 0; }
CURLcode perform() { return curl_easy_perform(h_); }

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

return curl.perform();
const auto res = curl.perform();
if(res == CURLE_OK)
return true;
bnw::cerr << "Download error: " << curl_easy_strerror(res) << '\n';
return false;
}

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

0 comments on commit 51196ff

Please sign in to comment.