use unified http method for plugin installation + add more exceptions

#573
#610
This commit is contained in:
bao-qian
2016-05-10 20:26:47 +01:00
parent 8325083402
commit 6359826fd9
7 changed files with 111 additions and 108 deletions

View File

@@ -19,7 +19,7 @@ namespace Wox.Core
public static async void UpdateApp()
{
var client = new WebClient {Proxy = HttpRequest.WebProxy(HttpProxy.Instance)};
var client = new WebClient {Proxy = Http.WebProxy(HttpProxy.Instance)};
var downloader = new FileDownloader(client);
try
@@ -59,10 +59,22 @@ namespace Wox.Core
}
}
public static async Task<string> NewVersion()
{
const string githubAPI = @"https://api.github.com/repos/wox-launcher/wox/releases/latest";
var response = await HttpRequest.Get(githubAPI, HttpProxy.Instance);
string response;
try
{
response = await Http.Get(githubAPI, HttpProxy.Instance);
}
catch (WebException e)
{
Log.Warn("Can't connect to github api to check new version");
Log.Error(e);
return string.Empty;
}
if (!string.IsNullOrEmpty(response))
{