From e392722b5e6609268eeb95bd2cf182ee84c0fb3a Mon Sep 17 00:00:00 2001 From: abraunegg Date: Sat, 25 Jan 2025 18:23:48 +1100 Subject: [PATCH] Fix testInternetReachability function (#3087) * Function should always return a boolean value and not throw an exception --- src/util.d | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/util.d b/src/util.d index 0ecc15ef..38646e92 100644 --- a/src/util.d +++ b/src/util.d @@ -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!({}));