feat: show why update failed when updating a single plugin

This commit is contained in:
goat 2023-11-02 19:52:23 +01:00
parent 7f87d2a9d2
commit b73ac2f3f7
No known key found for this signature in database
GPG key ID: 49E2AA8C6A76498B
3 changed files with 12 additions and 5 deletions

View file

@ -2779,8 +2779,15 @@ internal class PluginInstallerWindow : Window, IDisposable
// There is no need to set as Complete for an individual plugin installation
this.installStatus = OperationStatus.Idle;
var errorMessage = Locs.ErrorModal_SingleUpdateFail(update.UpdateManifest.Name);
return this.DisplayErrorContinuation(task, errorMessage);
if (task.IsCompletedSuccessfully &&
task.Result.Status != PluginUpdateStatus.StatusKind.Success)
{
this.ShowErrorModal(
Locs.ErrorModal_SingleUpdateFail(update.UpdateManifest.Name, PluginUpdateStatus.LocalizeUpdateStatusKind(task.Result.Status)));
return false;
}
return this.DisplayErrorContinuation(task, Locs.ErrorModal_SingleUpdateFail(update.UpdateManifest.Name, "Exception"));
});
}
@ -3623,7 +3630,7 @@ internal class PluginInstallerWindow : Window, IDisposable
public static string ErrorModal_InstallFail(string name) => Loc.Localize("InstallerInstallFail", "Failed to install plugin {0}.\n{1}").Format(name, ErrorModal_InstallContactAuthor);
public static string ErrorModal_SingleUpdateFail(string name) => Loc.Localize("InstallerSingleUpdateFail", "Failed to update plugin {0}.\n{1}").Format(name, ErrorModal_InstallContactAuthor);
public static string ErrorModal_SingleUpdateFail(string name, string why) => Loc.Localize("InstallerSingleUpdateFail", "Failed to update plugin {0} ({1}).\n{2}").Format(name, why, ErrorModal_InstallContactAuthor);
public static string ErrorModal_DeleteConfigFail(string name) => Loc.Localize("InstallerDeleteConfigFail", "Failed to reset the plugin {0}.\n\nThe plugin may not support this action. You can try deleting the configuration manually while the game is shut down - please see the FAQ.").Format(name);

View file

@ -1201,13 +1201,14 @@ internal partial class PluginManager : IDisposable, IServiceType
return await response.Content.ReadAsStreamAsync();
}
/// <summary>
/// Install a plugin from a repository and load it.
/// </summary>
/// <param name="repoManifest">The plugin definition.</param>
/// <param name="useTesting">If the testing version should be used.</param>
/// <param name="reason">The reason this plugin was loaded.</param>
/// <param name="zipStream">Stream of the ZIP archive containing the plugin that is about to be installed.</param>
/// <param name="inheritedWorkingPluginId">WorkingPluginId this plugin should inherit.</param>
/// <returns>A <see cref="Task"/> representing the asynchronous operation.</returns>
private async Task<LocalPlugin> InstallPluginInternalAsync(RemotePluginManifest repoManifest, bool useTesting, PluginLoadReason reason, Stream zipStream, Guid? inheritedWorkingPluginId = null)

View file

@ -1,4 +1,3 @@
using System;
using CheapLoc;
namespace Dalamud.Plugin.Internal.Types;