Skip to content

Commit

Permalink
Put version parse in try catch
Browse files Browse the repository at this point in the history
  • Loading branch information
pierr3 committed May 4, 2024
1 parent 16b5c67 commit 9e58d4f
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions backend/src/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -672,15 +672,15 @@ bool CheckVersionSync(const Napi::CallbackInfo& /*info*/)
// We force do a mandatory version check, if an update is needed, the
// programme won't run

httplib::Client client(VERSION_CHECK_BASE_URL);
auto res = client.Get(VERSION_CHECK_ENDPOINT);
if (!res || res->status != httplib::StatusCode::OK_200) {
mainStaticData::ShouldRun = false;
TRACK_LOG_CRITICAL("Error fetching version: {}", res->status);
return false;
}

try {
httplib::Client client(VERSION_CHECK_BASE_URL);
auto res = client.Get(VERSION_CHECK_ENDPOINT);
if (!res || res->status != httplib::StatusCode::OK_200) {
mainStaticData::ShouldRun = false;
TRACK_LOG_CRITICAL("Error fetching version: {}", res->status);
return false;
}

std::string cleanBody = res->body;
absl::StripAsciiWhitespace(&cleanBody);
auto mandatoryVersion = semver::version(cleanBody);
Expand Down

0 comments on commit 9e58d4f

Please sign in to comment.