Skip to content

Commit

Permalink
Small Update
Browse files Browse the repository at this point in the history
  • Loading branch information
isHarryh committed Feb 11, 2024
2 parents 056d432 + aa1b686 commit b8091f8
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 83 deletions.
14 changes: 14 additions & 0 deletions core/src/cn/harryh/arkpets/concurrent/ProcessPool.java
Original file line number Diff line number Diff line change
Expand Up @@ -78,4 +78,18 @@ public boolean isSuccess() {
return exitValue() == 0;
}
}


public static class UnexpectedExitCodeException extends Exception {
private final int exitCode;

public UnexpectedExitCodeException(int exitCode) {
this.exitCode = exitCode;
}

@Override
public String getMessage() {
return "The process exited with a non-zero exit code: " + exitCode;
}
}
}
79 changes: 0 additions & 79 deletions core/src/cn/harryh/arkpets/utils/JavaProcess.java

This file was deleted.

5 changes: 2 additions & 3 deletions desktop/src/cn/harryh/arkpets/controllers/RootModule.java
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@
import cn.harryh.arkpets.guitasks.GuiTask;
import cn.harryh.arkpets.utils.ArgPending;
import cn.harryh.arkpets.utils.GuiPrefabs;
import cn.harryh.arkpets.utils.JavaProcess;
import cn.harryh.arkpets.utils.Logger;
import com.jfoenix.controls.*;
import javafx.application.Platform;
Expand Down Expand Up @@ -42,7 +41,7 @@

public final class RootModule implements Controller<ArkHomeFX> {
public Handbook trayExitHandbook = new TrayExitHandBook();
public JavaProcess.UnexpectedExitCodeException lastLaunchFailed;
public ProcessPool.UnexpectedExitCodeException lastLaunchFailed;
public GuiPrefabs.PeerNodeComposer moduleWrapperComposer;

@FXML
Expand Down Expand Up @@ -158,7 +157,7 @@ protected Boolean call() throws InterruptedException, ExecutionException {
// ArkPets core finalized.
if (!future.get().isSuccess()) {
Logger.warn("Launcher", "Detected an abnormal finalization of an ArkPets thread (exit code -1). Please check the log file for details.");
lastLaunchFailed = new JavaProcess.UnexpectedExitCodeException(-1);
lastLaunchFailed = new ProcessPool.UnexpectedExitCodeException(-1);
return false;
}
Logger.debug("Launcher", "Detected a successful finalization of an ArkPets thread.");
Expand Down
3 changes: 2 additions & 1 deletion desktop/src/cn/harryh/arkpets/utils/GuiPrefabs.java
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
package cn.harryh.arkpets.utils;

import cn.harryh.arkpets.Const;
import cn.harryh.arkpets.concurrent.ProcessPool;
import com.jfoenix.controls.*;
import javafx.animation.FadeTransition;
import javafx.collections.ObservableList;
Expand Down Expand Up @@ -209,7 +210,7 @@ public static JFXDialog createErrorDialog(StackPane root, Throwable e) {
layout.setActions(DialogUtil.getOkayButton(dialog, root));
dialog.setContent(layout);

if (e instanceof JavaProcess.UnexpectedExitCodeException) {
if (e instanceof ProcessPool.UnexpectedExitCodeException) {
h2.setText("检测到桌宠异常退出");
h3.setText("桌宠运行时异常退出。如果该现象是在启动后立即发生的,可能是因为暂不支持该模型。您可以稍后重试或查看日志文件。");
} else if (e instanceof FileNotFoundException) {
Expand Down

0 comments on commit b8091f8

Please sign in to comment.