From 2271ec16fd556e88ccf21f1765e51ac27848ee18 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=BC=98=E9=9F=AC=20=E5=BC=A0?= Date: Fri, 29 Jan 2021 12:17:17 +0800 Subject: [PATCH] Optimize exception message logic --- Plugins/Flow.Launcher.Plugin.PluginsManager/Main.cs | 13 ++----------- .../PluginsManager.cs | 6 +++++- 2 files changed, 7 insertions(+), 12 deletions(-) diff --git a/Plugins/Flow.Launcher.Plugin.PluginsManager/Main.cs b/Plugins/Flow.Launcher.Plugin.PluginsManager/Main.cs index c9f9ca2a7..dbd1600c9 100644 --- a/Plugins/Flow.Launcher.Plugin.PluginsManager/Main.cs +++ b/Plugins/Flow.Launcher.Plugin.PluginsManager/Main.cs @@ -71,17 +71,8 @@ namespace Flow.Launcher.Plugin.PluginsManager { _ = pluginManager.UpdateManifest().ContinueWith(t => { - if (t.IsCompletedSuccessfully) - { - lastUpdateTime = DateTime.Now; - } - else - { - Context.API.ShowMsg("Plugin Manifest Download Fail.", - "Please check if you can connect to github.com. " + - "This error means you may not be able to Install and Update Plugin.", pluginManager.icoPath, false); - } - }); + lastUpdateTime = DateTime.Now; + }, TaskContinuationOptions.OnlyOnRanToCompletion); } return search switch diff --git a/Plugins/Flow.Launcher.Plugin.PluginsManager/PluginsManager.cs b/Plugins/Flow.Launcher.Plugin.PluginsManager/PluginsManager.cs index eb0caec3f..090e93bf2 100644 --- a/Plugins/Flow.Launcher.Plugin.PluginsManager/PluginsManager.cs +++ b/Plugins/Flow.Launcher.Plugin.PluginsManager/PluginsManager.cs @@ -48,7 +48,11 @@ namespace Flow.Launcher.Plugin.PluginsManager internal Task UpdateManifest() { - return _downloadManifestTask = pluginsManifest.DownloadManifest(); + return _downloadManifestTask = pluginsManifest.DownloadManifest().ContinueWith(t => + Context.API.ShowMsg("Plugin Manifest Download Fail.", + "Please check if you can connect to github.com. " + + "This error means you may not be able to Install and Update Plugin.", icoPath, false), + TaskContinuationOptions.OnlyOnFaulted); } internal List GetDefaultHotKeys()