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);
|
var suggestions = await source.Suggestions(keyword, token).ConfigureAwait(false);
|
||||||
|
|
||||||
if (token.IsCancellationRequested)
|
token.ThrowIfCancellationRequested();
|
||||||
return null;
|
|
||||||
|
|
||||||
var resultsFromSuggestion = suggestions?.Select(o => new Result
|
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=";
|
const string api = "http://suggestion.baidu.com/su?json=1&wd=";
|
||||||
result = await Http.GetAsync(api + Uri.EscapeUriString(query), token).ConfigureAwait(false);
|
result = await Http.GetAsync(api + Uri.EscapeUriString(query), token).ConfigureAwait(false);
|
||||||
}
|
}
|
||||||
catch (TaskCanceledException)
|
catch (OperationCanceledException)
|
||||||
{
|
{
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -28,7 +28,7 @@ namespace Flow.Launcher.Plugin.WebSearch.SuggestionSources
|
||||||
json = (await JsonDocument.ParseAsync(resultStream, cancellationToken: token)).RootElement.GetProperty("AS");
|
json = (await JsonDocument.ParseAsync(resultStream, cancellationToken: token)).RootElement.GetProperty("AS");
|
||||||
|
|
||||||
}
|
}
|
||||||
catch (TaskCanceledException)
|
catch (OperationCanceledException)
|
||||||
{
|
{
|
||||||
return new List<string>();
|
return new List<string>();
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -24,10 +24,10 @@ namespace Flow.Launcher.Plugin.WebSearch.SuggestionSources
|
||||||
|
|
||||||
using var resultStream = await Http.GetStreamAsync(api + Uri.EscapeUriString(query)).ConfigureAwait(false);
|
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>();
|
return new List<string>();
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue