From 052324d2769d3db1768c9c216adc040cf93171f1 Mon Sep 17 00:00:00 2001 From: bluepilledgreat <97983689+bluepilledgreat@users.noreply.github.com> Date: Sat, 4 May 2024 17:07:34 +0100 Subject: [PATCH 1/4] handle not being able to fetch emoji preset --- Bloxstrap/Bootstrapper.cs | 17 ++++++++++++++--- Bloxstrap/Resources/Strings.Designer.cs | 9 +++++++++ Bloxstrap/Resources/Strings.resx | 3 +++ 3 files changed, 26 insertions(+), 3 deletions(-) diff --git a/Bloxstrap/Bootstrapper.cs b/Bloxstrap/Bootstrapper.cs index 909c978..7113b4b 100644 --- a/Bloxstrap/Bootstrapper.cs +++ b/Bloxstrap/Bootstrapper.cs @@ -4,6 +4,7 @@ using System.Windows.Forms; using Microsoft.Win32; using Bloxstrap.Integrations; +using Bloxstrap.Resources; namespace Bloxstrap { @@ -1185,9 +1186,19 @@ namespace Bloxstrap Directory.CreateDirectory(contentFonts); - var response = await App.HttpClient.GetAsync(App.Settings.Prop.EmojiType.GetUrl()); - await using var fileStream = new FileStream(emojiFontLocation, FileMode.CreateNew); - await response.Content.CopyToAsync(fileStream); + try + { + var response = await App.HttpClient.GetAsync(App.Settings.Prop.EmojiType.GetUrl()); + response.EnsureSuccessStatusCode(); + await using var fileStream = new FileStream(emojiFontLocation, FileMode.CreateNew); + await response.Content.CopyToAsync(fileStream); + } + catch (HttpRequestException ex) + { + App.Logger.WriteLine(LOG_IDENT, $"Failed to fetch emoji preset from Github: {ex}"); + Frontend.ShowMessageBox(string.Format(Strings.Bootstrapper_EmojiPresetFetchFailed, App.Settings.Prop.EmojiType), MessageBoxImage.Error); + App.Settings.Prop.EmojiType = EmojiType.Default; + } } // check custom font mod diff --git a/Bloxstrap/Resources/Strings.Designer.cs b/Bloxstrap/Resources/Strings.Designer.cs index 2a7a0da..403f056 100644 --- a/Bloxstrap/Resources/Strings.Designer.cs +++ b/Bloxstrap/Resources/Strings.Designer.cs @@ -133,6 +133,15 @@ namespace Bloxstrap.Resources { } } + /// + /// Looks up a localized string similar to Failed to fetch the {0} emoji preset. Your preferred emoji type has been set back to default.. + /// + public static string Bootstrapper_EmojiPresetFetchFailed { + get { + return ResourceManager.GetString("Bootstrapper.EmojiPresetFetchFailed", resourceCulture); + } + } + /// /// Looks up a localized string similar to You must first install Bloxstrap before uninstalling.. /// diff --git a/Bloxstrap/Resources/Strings.resx b/Bloxstrap/Resources/Strings.resx index d24de5b..cfe67d0 100644 --- a/Bloxstrap/Resources/Strings.resx +++ b/Bloxstrap/Resources/Strings.resx @@ -142,6 +142,9 @@ Would you like to switch to the default channel ({1})? Roblox was launched via a deeplink, however the desktop app is required for deeplink launching to work. Because you've opted to disable the desktop app, it will temporarily be re-enabled for this launch only. + + Failed to fetch the {0} emoji preset. Your preferred emoji type has been set back to default. + You must first install Bloxstrap before uninstalling. From 7ece6517e8cf1fe7161a37dbe24ea033b4f38e17 Mon Sep 17 00:00:00 2001 From: pizzaboxer Date: Sun, 5 May 2024 11:51:21 +0100 Subject: [PATCH 2/4] Emoji preset message: warn instead of error --- Bloxstrap/Bootstrapper.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Bloxstrap/Bootstrapper.cs b/Bloxstrap/Bootstrapper.cs index 7113b4b..b5758ae 100644 --- a/Bloxstrap/Bootstrapper.cs +++ b/Bloxstrap/Bootstrapper.cs @@ -1196,7 +1196,7 @@ namespace Bloxstrap catch (HttpRequestException ex) { App.Logger.WriteLine(LOG_IDENT, $"Failed to fetch emoji preset from Github: {ex}"); - Frontend.ShowMessageBox(string.Format(Strings.Bootstrapper_EmojiPresetFetchFailed, App.Settings.Prop.EmojiType), MessageBoxImage.Error); + Frontend.ShowMessageBox(string.Format(Strings.Bootstrapper_EmojiPresetFetchFailed, App.Settings.Prop.EmojiType), MessageBoxImage.Warning); App.Settings.Prop.EmojiType = EmojiType.Default; } } From 2bd3ef55365518ed563b25759345b3b93c3a98fb Mon Sep 17 00:00:00 2001 From: pizzaboxer Date: Sun, 5 May 2024 11:52:51 +0100 Subject: [PATCH 3/4] Emoji preset message: better error description --- Bloxstrap/Resources/Strings.resx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Bloxstrap/Resources/Strings.resx b/Bloxstrap/Resources/Strings.resx index cfe67d0..27b3a1c 100644 --- a/Bloxstrap/Resources/Strings.resx +++ b/Bloxstrap/Resources/Strings.resx @@ -143,7 +143,7 @@ Would you like to switch to the default channel ({1})? Roblox was launched via a deeplink, however the desktop app is required for deeplink launching to work. Because you've opted to disable the desktop app, it will temporarily be re-enabled for this launch only. - Failed to fetch the {0} emoji preset. Your preferred emoji type has been set back to default. + Could not apply the {0} emoji mod preset because of a network error. To try again, please reconfigure the option in the Bloxstrap Menu. You must first install Bloxstrap before uninstalling. @@ -1047,4 +1047,4 @@ Selecting 'No' will ignore this warning and continue installation. Would you like to switch your preferred channel to {0}? - \ No newline at end of file + From a7f5bd5956ec6cf50079994bd16f463435e7bf55 Mon Sep 17 00:00:00 2001 From: pizzaboxer Date: Sun, 5 May 2024 11:54:07 +0100 Subject: [PATCH 4/4] Emoji preset message: log exception properly --- Bloxstrap/Bootstrapper.cs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Bloxstrap/Bootstrapper.cs b/Bloxstrap/Bootstrapper.cs index b5758ae..8cf712f 100644 --- a/Bloxstrap/Bootstrapper.cs +++ b/Bloxstrap/Bootstrapper.cs @@ -1195,7 +1195,8 @@ namespace Bloxstrap } catch (HttpRequestException ex) { - App.Logger.WriteLine(LOG_IDENT, $"Failed to fetch emoji preset from Github: {ex}"); + App.Logger.WriteLine(LOG_IDENT, $"Failed to fetch emoji preset from Github"); + App.Logger.WriteException(LOG_IDENT, ex); Frontend.ShowMessageBox(string.Format(Strings.Bootstrapper_EmojiPresetFetchFailed, App.Settings.Prop.EmojiType), MessageBoxImage.Warning); App.Settings.Prop.EmojiType = EmojiType.Default; }