mirror of
https://github.com/chylex/TweetDuck.git
synced 2025-05-22 17:34:06 +02:00
Add error handling when checking updates, and remove unnecessary TODO
This commit is contained in:
parent
d20541fd24
commit
b7d3758bea
@ -39,6 +39,7 @@ public bool IsWaiting{
|
|||||||
}
|
}
|
||||||
|
|
||||||
public string UpdateInstallerPath { get; private set; }
|
public string UpdateInstallerPath { get; private set; }
|
||||||
|
private bool ignoreUpdateCheckError;
|
||||||
|
|
||||||
public AnalyticsFile AnalyticsFile => analytics?.File ?? AnalyticsFile.Dummy;
|
public AnalyticsFile AnalyticsFile => analytics?.File ?? AnalyticsFile.Dummy;
|
||||||
|
|
||||||
@ -247,7 +248,12 @@ private void updates_CheckFinished(object sender, UpdateCheckEventArgs e){
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}, ex => {
|
}, 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();
|
Resources.ScriptLoader.HotSwap();
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
ignoreUpdateCheckError = false;
|
||||||
browser.ReloadToTweetDeck();
|
browser.ReloadToTweetDeck();
|
||||||
AnalyticsFile.BrowserReloads.Trigger();
|
AnalyticsFile.BrowserReloads.Trigger();
|
||||||
}
|
}
|
||||||
|
@ -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);
|
FormMessage.Information("No Updates Available", "Your version of TweetDuck is up to date.", FormMessage.OK);
|
||||||
}
|
}
|
||||||
}, ex => {
|
}, 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);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
@ -21,7 +21,7 @@ public Task<UpdateInfo> Check(){
|
|||||||
TaskCompletionSource<UpdateInfo> result = new TaskCompletionSource<UpdateInfo>();
|
TaskCompletionSource<UpdateInfo> result = new TaskCompletionSource<UpdateInfo>();
|
||||||
|
|
||||||
WebClient client = BrowserUtils.CreateWebClient();
|
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 => {
|
client.DownloadStringTaskAsync(ApiLatestRelease).ContinueWith(task => {
|
||||||
if (task.IsCanceled){
|
if (task.IsCanceled){
|
||||||
|
Loading…
Reference in New Issue
Block a user