Skip to content

Commit

Permalink
Work in progress
Browse files Browse the repository at this point in the history
  • Loading branch information
skhaz committed Dec 1, 2024
1 parent b6de3cc commit cc73fb9
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions src/networkmanager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ networkmanager::networkmanager() {
#ifndef EMSCRIPTEN
const auto result = curl_global_init(CURL_GLOBAL_DEFAULT);
if (result != CURLE_OK) {
throw std::runtime_error(fmt::format("Failed to initialize CURL: {}", curl_easy_strerror(static_cast<CURLcode>(result)));
throw std::runtime_error(fmt::format("Failed to initialize CURL: {}", curl_easy_strerror(result)));
}
#endif
}
Expand Down Expand Up @@ -99,13 +99,13 @@ void networkmanager::send(const networkrequest &request) {
});
curl_easy_setopt(curl.get(), CURLOPT_WRITEDATA, &data);

const auto res = curl_easy_perform(curl.get());
if (res != CURLE_OK) {
throw std::runtime_error(fmt::format("CURL request failed: {}", curl_easy_strerror(res)));
const auto result = curl_easy_perform(curl.get());
if (result != CURLE_OK) {
throw std::runtime_error(fmt::format("CURL request failed: {}", curl_easy_strerror(result)));
}

long response_code = 0;
curl_easy_getinfo(curl.get(), CURLINFO_RESPONSE_CODE, &response_code);
request.callback(data, response_code);
long code = 0;
curl_easy_getinfo(curl.get(), CURLINFO_RESPONSE_CODE, &code);
request.callback(data, code);
#endif
}

0 comments on commit cc73fb9

Please sign in to comment.