Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Recover version check ability #149

Merged
merged 21 commits into from
Jan 13, 2025
Merged
Changes from 1 commit
Commits
Show all changes
21 commits
Select commit Hold shift + click to select a range
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
display error when instantiating is not succeeded.
  • Loading branch information
hizumiaoba committed Dec 20, 2024
commit 2dff45ecdee0a52ca9932a04c88a5a42c9ce186c
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,17 @@ void initialize() {
this.versionInfoLabel.setText(this.versionInfo.formatted(clientVersion, downConvert(remoteVersionCache).asStringNotation()));
}

this.checker = new VersionChecker();
try {
this.checker = new VersionChecker();
} catch (IOException e) {
log.error("Failed to initialize VersionChecker due to an I/O error", e);
Alert alert = new Alert(Alert.AlertType.ERROR);
alert.setTitle("エラー");
alert.setHeaderText("バージョン確認に必要な初期化処理に失敗しました");
alert.setContentText("通常のバックアップ処理には影響ありませんが、バージョン確認機能は利用できません。");
alert.initModality(Modality.APPLICATION_MODAL);
alert.showAndWait();
}
this.clientVersion = VersionObj.parse(MineCraftTimeMachineApplication.class.getAnnotation(
Version.class));
}
Expand All @@ -92,7 +102,8 @@ void onCheckUpdateClicked(ActionEvent e) {
if(remoteVersionCache == null) {
log.trace("Remote version cache is null");
remoteVersionCache = checker.getLatestVersion(false)
.orElseThrow(() -> new RuntimeException("Failed to get latest version"));
.map(MinimalRemoteVersionCrate::of)
.orElseThrow(() -> new RuntimeException("Failed to fetch the latest version"));
}
}
this.checkUpdateBtn.setDisable(false);
Expand Down