From 2e4127c63b0de314f155c19e154a30c6c1294cba Mon Sep 17 00:00:00 2001 From: Vic <10308169+VictoriousRaptor@users.noreply.github.com> Date: Thu, 19 Jan 2023 00:37:05 +0800 Subject: [PATCH] Catch specifc exception --- .../Search/SearchManager.cs | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/Plugins/Flow.Launcher.Plugin.Explorer/Search/SearchManager.cs b/Plugins/Flow.Launcher.Plugin.Explorer/Search/SearchManager.cs index 93a81f947..b3c118fca 100644 --- a/Plugins/Flow.Launcher.Plugin.Explorer/Search/SearchManager.cs +++ b/Plugins/Flow.Launcher.Plugin.Explorer/Search/SearchManager.cs @@ -105,14 +105,16 @@ namespace Flow.Launcher.Plugin.Explorer.Search await foreach (var search in searchResults.WithCancellation(token).ConfigureAwait(false)) results.Add(ResultManager.CreateResult(query, search)); } + catch (OperationCanceledException) + { + return results.ToList(); + } + catch (EngineNotAvailableException) + { + throw; + } catch (Exception e) { - if (e is OperationCanceledException) - return results.ToList(); - - if (e is EngineNotAvailableException) - throw; - throw new SearchException(engineName, e.Message, e); }