mirror of
https://github.com/Flow-Launcher/Flow.Launcher.git
synced 2026-03-11 08:54:32 +00:00
Merge pull request #364 from Flow-Launcher/FixUpdateCancelledException
change taskcanceledexception to operationcanceledexception
This commit is contained in:
commit
890f114931
6 changed files with 20 additions and 20 deletions
|
|
@ -87,7 +87,7 @@ namespace Flow.Launcher.Core
|
|||
UpdateManager.RestartApp(Constant.ApplicationFileName);
|
||||
}
|
||||
}
|
||||
catch (Exception e) when (e is HttpRequestException || e is WebException || e is SocketException || e is TaskCanceledException)
|
||||
catch (Exception e) when (e is HttpRequestException || e is WebException || e is SocketException || e.InnerException is TimeoutException)
|
||||
{
|
||||
Log.Exception($"|Updater.UpdateApp|Check your connection and proxy settings to github-cloud.s3.amazonaws.com.", e);
|
||||
api.ShowMsg(api.GetTranslation("update_flowlauncher_fail"),
|
||||
|
|
|
|||
|
|
@ -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,15 +25,16 @@ 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)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
catch (HttpRequestException e)
|
||||
catch (Exception e) when (e is HttpRequestException || e.InnerException is TimeoutException)
|
||||
{
|
||||
Log.Exception("|Baidu.Suggestions|Can't get suggestion from baidu", e);
|
||||
return null;
|
||||
}
|
||||
catch (OperationCanceledException)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
if (string.IsNullOrEmpty(result)) return new List<string>();
|
||||
Match match = _reg.Match(result);
|
||||
|
|
@ -44,7 +45,7 @@ namespace Flow.Launcher.Plugin.WebSearch.SuggestionSources
|
|||
{
|
||||
json = JsonDocument.Parse(match.Groups[1].Value);
|
||||
}
|
||||
catch(JsonException e)
|
||||
catch (JsonException e)
|
||||
{
|
||||
Log.Exception("|Baidu.Suggestions|can't parse suggestions", e);
|
||||
return new List<string>();
|
||||
|
|
|
|||
|
|
@ -28,13 +28,13 @@ namespace Flow.Launcher.Plugin.WebSearch.SuggestionSources
|
|||
json = (await JsonDocument.ParseAsync(resultStream, cancellationToken: token)).RootElement.GetProperty("AS");
|
||||
|
||||
}
|
||||
catch (TaskCanceledException)
|
||||
catch (Exception e) when (e is HttpRequestException || e.InnerException is TimeoutException)
|
||||
{
|
||||
return new List<string>();
|
||||
Log.Exception("|Baidu.Suggestions|Can't get suggestion from baidu", e);
|
||||
return null;
|
||||
}
|
||||
catch (HttpRequestException e)
|
||||
catch (OperationCanceledException)
|
||||
{
|
||||
Log.Exception("|Bing.Suggestions|Can't get suggestion from Bing", e);
|
||||
return new List<string>();
|
||||
}
|
||||
catch (JsonException e)
|
||||
|
|
|
|||
|
|
@ -23,17 +23,17 @@ 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 (Exception e) when (e is HttpRequestException || e.InnerException is TimeoutException)
|
||||
{
|
||||
return new List<string>();
|
||||
Log.Exception("|Baidu.Suggestions|Can't get suggestion from baidu", e);
|
||||
return null;
|
||||
}
|
||||
catch (HttpRequestException e)
|
||||
catch (OperationCanceledException)
|
||||
{
|
||||
Log.Exception("|Google.Suggestions|Can't get suggestion from google", e);
|
||||
return new List<string>();
|
||||
}
|
||||
catch (JsonException e)
|
||||
|
|
|
|||
|
|
@ -25,7 +25,7 @@
|
|||
"Name": "Web Searches",
|
||||
"Description": "Provide the web search ability",
|
||||
"Author": "qianlifeng",
|
||||
"Version": "1.3.2",
|
||||
"Version": "1.3.3",
|
||||
"Language": "csharp",
|
||||
"Website": "https://github.com/Flow-Launcher/Flow.Launcher",
|
||||
"ExecuteFileName": "Flow.Launcher.Plugin.WebSearch.dll",
|
||||
|
|
|
|||
Loading…
Reference in a new issue