Added the specific exception

This commit is contained in:
Andrey Zavadskiy
2017-02-18 13:46:47 +03:00
parent 2f4855b00f
commit e803564b5a
3 changed files with 48 additions and 27 deletions

View File

@ -15,7 +15,7 @@ using osu.Framework.Graphics.Textures;
using osu.Game.Graphics;
using OpenTK;
using OpenTK.Graphics;
using System;
using System.Net.Http;
namespace osu.Desktop.Overlays
{
@ -116,32 +116,33 @@ namespace osu.Desktop.Overlays
try
{
updateManager = await UpdateManager.GitHubUpdateManager(@"https://github.com/ppy/osu", @"osulazer", null, null, true);
if (!updateManager.IsInstalledApp)
return;
var info = await updateManager.CheckForUpdate();
if (info.ReleasesToApply.Count > 0)
{
ProgressNotification n = new UpdateProgressNotification
{
Text = @"Downloading update..."
};
Schedule(() => notification.Post(n));
Schedule(() => n.State = ProgressNotificationState.Active);
await updateManager.DownloadReleases(info.ReleasesToApply, (int p) => Schedule(() => n.Progress = p / 100f));
Schedule(() => n.Text = @"Installing update...");
await updateManager.ApplyReleases(info, (int p) => Schedule(() => n.Progress = p / 100f));
Schedule(() => n.State = ProgressNotificationState.Completed);
}
else
{
//check again every 30 minutes.
Scheduler.AddDelayed(updateChecker, 60000 * 30);
}
}
catch(Exception e)
catch(HttpRequestException)
{
//check again every 30 minutes.
Scheduler.AddDelayed(updateChecker, 60000 * 30);
return;
}
if (!updateManager.IsInstalledApp)
return;
var info = await updateManager.CheckForUpdate();
if (info.ReleasesToApply.Count > 0)
{
ProgressNotification n = new UpdateProgressNotification
{
Text = @"Downloading update..."
};
Schedule(() => notification.Post(n));
Schedule(() => n.State = ProgressNotificationState.Active);
await updateManager.DownloadReleases(info.ReleasesToApply, (int p) => Schedule(() => n.Progress = p / 100f));
Schedule(() => n.Text = @"Installing update...");
await updateManager.ApplyReleases(info, (int p) => Schedule(() => n.Progress = p / 100f));
Schedule(() => n.State = ProgressNotificationState.Completed);
}
else
{
//check again every 30 minutes.
Scheduler.AddDelayed(updateChecker, 60000 * 30);