Fix testInternetReachability function (#3087)

* Function should always return a boolean value and not throw an exception
This commit is contained in:
abraunegg 2025-01-25 18:23:48 +11:00 committed by GitHub
commit e392722b5e
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -255,11 +255,11 @@ bool testInternetReachability(ApplicationConfig appConfig) {
// Check response for HTTP status code
if (http.statusLine.code >= 200 && http.statusLine.code < 400) {
addLogEntry("Successfully reached Microsoft OneDrive Login Service");
return true;
} else {
addLogEntry("Failed to reach Microsoft OneDrive Login Service. HTTP status code: " ~ to!string(http.statusLine.code));
throw new Exception("HTTP Request Failed with Status Code: " ~ to!string(http.statusLine.code));
return false;
}
return true;
} catch (SocketException e) {
addLogEntry("Cannot connect to Microsoft OneDrive Service - Socket Issue: " ~ e.msg);
displayOneDriveErrorMessage(e.msg, getFunctionName!({}));