From 4e3746f77d6355ce6e2798258a9cb2e74e5ac42d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=BC=A0=E5=BC=98=E9=9F=AC?= Date: Tue, 27 Jul 2021 11:15:27 +0800 Subject: [PATCH] Don't rethrow OperationCanceledException --- Flow.Launcher.Core/Plugin/JsonRPCPlugin.cs | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/Flow.Launcher.Core/Plugin/JsonRPCPlugin.cs b/Flow.Launcher.Core/Plugin/JsonRPCPlugin.cs index 5e44bef86..58bd40807 100644 --- a/Flow.Launcher.Core/Plugin/JsonRPCPlugin.cs +++ b/Flow.Launcher.Core/Plugin/JsonRPCPlugin.cs @@ -254,7 +254,7 @@ namespace Flow.Launcher.Core.Plugin catch (OperationCanceledException) { await buffer.DisposeAsync(); - throw; + return Stream.Null; } buffer.Seek(0, SeekOrigin.Begin); @@ -289,11 +289,15 @@ namespace Flow.Launcher.Core.Plugin public async Task> QueryAsync(Query query, CancellationToken token) { - var output = await ExecuteQueryAsync(query, token); try { + var output = await ExecuteQueryAsync(query, token); return await DeserializedResultAsync(output); } + catch (OperationCanceledException) + { + return null; + } catch (Exception e) { Log.Exception($"|JsonRPCPlugin.Query|Exception when query <{query}>", e);