1
0
mirror of https://github.com/chylex/TweetDuck.git synced 2025-05-05 11:34:07 +02:00

Add error handling when checking updates, and remove unnecessary TODO

This commit is contained in:
chylex 2018-04-15 14:03:11 +02:00
parent d20541fd24
commit b7d3758bea
3 changed files with 10 additions and 3 deletions

View File

@ -39,6 +39,7 @@ public bool IsWaiting{
}
public string UpdateInstallerPath { get; private set; }
private bool ignoreUpdateCheckError;
public AnalyticsFile AnalyticsFile => analytics?.File ?? AnalyticsFile.Dummy;
@ -247,7 +248,12 @@ private void updates_CheckFinished(object sender, UpdateCheckEventArgs e){
}
}
}, ex => {
// TODO show error and ask if the user wants to temporarily disable checks -- or maybe only do that for the first check of the day
if (!ignoreUpdateCheckError){
Program.Reporter.HandleException("Update Check Error", "An error occurred while checking for updates.", true, ex);
ignoreUpdateCheckError = true;
updates.StartTimer();
}
});
});
}
@ -329,6 +335,7 @@ public void ReloadToTweetDeck(){
Resources.ScriptLoader.HotSwap();
#endif
ignoreUpdateCheckError = false;
browser.ReloadToTweetDeck();
AnalyticsFile.BrowserReloads.Trigger();
}

View File

@ -227,7 +227,7 @@ private void updates_CheckFinished(object sender, UpdateCheckEventArgs e){
FormMessage.Information("No Updates Available", "Your version of TweetDuck is up to date.", FormMessage.OK);
}
}, ex => {
Program.Reporter.HandleException("Update Check", "Encountered an error while checking updates.", true, ex);
Program.Reporter.HandleException("Update Check Error", "An error occurred while checking for updates.", true, ex);
});
}
});

View File

@ -21,7 +21,7 @@ public Task<UpdateInfo> Check(){
TaskCompletionSource<UpdateInfo> result = new TaskCompletionSource<UpdateInfo>();
WebClient client = BrowserUtils.CreateWebClient();
client.Headers[HttpRequestHeader.Accept] = "application/vnd.github.v3+json"; // TODO could use .html to avoid custom markdown parsing
client.Headers[HttpRequestHeader.Accept] = "application/vnd.github.v3+json";
client.DownloadStringTaskAsync(ApiLatestRelease).ContinueWith(task => {
if (task.IsCanceled){