Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Flow.Launcher.Core/Updater.cs
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ public async Task UpdateApp(IPublicAPI api, bool silentUpdate = true)
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"),
Expand Down
3 changes: 1 addition & 2 deletions Plugins/Flow.Launcher.Plugin.WebSearch/Main.cs
Original file line number Diff line number Diff line change
Expand Up @@ -125,8 +125,7 @@ private async Task<IEnumerable<Result>> SuggestionsAsync(string keyword, string
{
var suggestions = await source.Suggestions(keyword, token).ConfigureAwait(false);

if (token.IsCancellationRequested)
return null;
token.ThrowIfCancellationRequested();

var resultsFromSuggestion = suggestions?.Select(o => new Result
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,16 +25,17 @@ public override async Task<List<string>> Suggestions(string query, CancellationT
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 (Exception e) when (e is HttpRequestException || e.InnerException is TimeoutException)
{
Log.Exception("|Baidu.Suggestions|Can't get suggestion from baidu", e);
return null;
}
catch (HttpRequestException e)
catch (OperationCanceledException)
{
Log.Exception("|Baidu.Suggestions|Can't get suggestion from baidu", e);
return null;
}


if (string.IsNullOrEmpty(result)) return new List<string>();
Match match = _reg.Match(result);
if (match.Success)
Expand All @@ -44,7 +45,7 @@ public override async Task<List<string>> Suggestions(string query, CancellationT
{
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>();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,13 +28,13 @@ public override async Task<List<string>> Suggestions(string query, CancellationT
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)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,17 +23,17 @@ public override async Task<List<string>> Suggestions(string query, CancellationT
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)
Expand Down
2 changes: 1 addition & 1 deletion Plugins/Flow.Launcher.Plugin.WebSearch/plugin.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down