mirror of
https://github.com/Flow-Launcher/Flow.Launcher.git
synced 2026-03-11 08:54:32 +00:00
Change TaskCanceledException in WebSearch plugin to operationCanceledException
This commit is contained in:
parent
e2fa9683b9
commit
b07b1ddb31
4 changed files with 6 additions and 7 deletions
|
|
@ -125,8 +125,7 @@ namespace Flow.Launcher.Plugin.WebSearch
|
|||
{
|
||||
var suggestions = await source.Suggestions(keyword, token).ConfigureAwait(false);
|
||||
|
||||
if (token.IsCancellationRequested)
|
||||
return null;
|
||||
token.ThrowIfCancellationRequested();
|
||||
|
||||
var resultsFromSuggestion = suggestions?.Select(o => new Result
|
||||
{
|
||||
|
|
|
|||
|
|
@ -25,7 +25,7 @@ namespace Flow.Launcher.Plugin.WebSearch.SuggestionSources
|
|||
const string api = "http://suggestion.baidu.com/su?json=1&wd=";
|
||||
result = await Http.GetAsync(api + Uri.EscapeUriString(query), token).ConfigureAwait(false);
|
||||
}
|
||||
catch (TaskCanceledException)
|
||||
catch (OperationCanceledException)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -28,7 +28,7 @@ namespace Flow.Launcher.Plugin.WebSearch.SuggestionSources
|
|||
json = (await JsonDocument.ParseAsync(resultStream, cancellationToken: token)).RootElement.GetProperty("AS");
|
||||
|
||||
}
|
||||
catch (TaskCanceledException)
|
||||
catch (OperationCanceledException)
|
||||
{
|
||||
return new List<string>();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -23,11 +23,11 @@ namespace Flow.Launcher.Plugin.WebSearch.SuggestionSources
|
|||
const string api = "https://www.google.com/complete/search?output=chrome&q=";
|
||||
|
||||
using var resultStream = await Http.GetStreamAsync(api + Uri.EscapeUriString(query)).ConfigureAwait(false);
|
||||
|
||||
json = await JsonDocument.ParseAsync(resultStream);
|
||||
|
||||
json = await JsonDocument.ParseAsync(resultStream, cancellationToken: token);
|
||||
|
||||
}
|
||||
catch (TaskCanceledException)
|
||||
catch (OperationCanceledException)
|
||||
{
|
||||
return new List<string>();
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue