Skip to content

Commit

Permalink
Fix error handling on HomePage when internet unavailable
Browse files Browse the repository at this point in the history
  • Loading branch information
pverscha committed Dec 9, 2020
1 parent f5ed28c commit a6e0c6f
Showing 1 changed file with 19 additions and 6 deletions.
25 changes: 19 additions & 6 deletions src/components/pages/HomePage.vue
Original file line number Diff line number Diff line change
Expand Up @@ -143,12 +143,7 @@ export default class HomePage extends Vue {
if (!HomePage.downloadCheckPerformed) {
HomePage.downloadCheckPerformed = true;
shouldUpdate = await this.checkStaticDatabaseUpdate();
const githubCommunicator = new GitHubCommunicator();
this.updateAvailable = Utils.isVersionLargerThan(
await githubCommunicator.getMostRecentVersion(),
this.version
);
this.updateAvailable = await this.checkApplicationUpdateAvailable();
}
this.loadingApplication = false;
Expand All @@ -171,6 +166,24 @@ export default class HomePage extends Vue {
"The application will work without these files, but will be slower or less accurate than usual."
);
}
return false;
}
private async checkApplicationUpdateAvailable(): Promise<boolean> {
try {
const githubCommunicator = new GitHubCommunicator();
return Utils.isVersionLargerThan(
await githubCommunicator.getMostRecentVersion(),
this.version
);
} catch (err) {
console.warn(err);
this.showError(
"Could not connect to GitHub and check for new updates. Make sure you're connected to the internet " +
"and retry."
);
}
return false;
}
private async updateStaticDatabase(): Promise<void> {
Expand Down

0 comments on commit a6e0c6f

Please sign in to comment.