From 38eac377a1c066bbda85e17e54abdd786b14444c Mon Sep 17 00:00:00 2001 From: goat Date: Fri, 7 Jun 2024 01:48:17 +0200 Subject: [PATCH] pi: treat cancellations as errors(fixes #1825) --- .../PluginInstaller/PluginInstallerWindow.cs | 21 ++++++++++--------- 1 file changed, 11 insertions(+), 10 deletions(-) diff --git a/Dalamud/Interface/Internal/Windows/PluginInstaller/PluginInstallerWindow.cs b/Dalamud/Interface/Internal/Windows/PluginInstaller/PluginInstallerWindow.cs index a4efb1f5e..c52e4d635 100644 --- a/Dalamud/Interface/Internal/Windows/PluginInstaller/PluginInstallerWindow.cs +++ b/Dalamud/Interface/Internal/Windows/PluginInstaller/PluginInstallerWindow.cs @@ -364,10 +364,13 @@ internal class PluginInstallerWindow : Window, IDisposable /// A value indicating whether to continue with the next task. public bool DisplayErrorContinuation(Task task, object state) { - if (task.IsFaulted) - { - var errorModalMessage = state as string; + if (!task.IsFaulted && !task.IsCanceled) + return true; + + var newErrorMessage = state as string; + if (task.Exception != null) + { foreach (var ex in task.Exception.InnerExceptions) { if (ex is PluginException) @@ -375,7 +378,7 @@ internal class PluginInstallerWindow : Window, IDisposable Log.Error(ex, "Plugin installer threw an error"); #if DEBUG if (!string.IsNullOrEmpty(ex.Message)) - errorModalMessage += $"\n\n{ex.Message}"; + newErrorMessage += $"\n\n{ex.Message}"; #endif } else @@ -383,17 +386,15 @@ internal class PluginInstallerWindow : Window, IDisposable Log.Error(ex, "Plugin installer threw an unexpected error"); #if DEBUG if (!string.IsNullOrEmpty(ex.Message)) - errorModalMessage += $"\n\n{ex.Message}"; + newErrorMessage += $"\n\n{ex.Message}"; #endif } } - - this.ShowErrorModal(errorModalMessage); - - return false; } - return true; + this.ShowErrorModal(newErrorMessage ?? "An unknown error occurred."); + + return false; } private void SetOpenPage(PluginInstallerOpenKind kind)