Feat: Better error handling

This commit is contained in:
xiaozhou233 committed 2026-08-26 12:03:29 +08:00
1 parent 07f4cc0663
commit db6433158f
4 files changed
+38 -5

No files matched your search

@@ -3,7 +3,11 @@ package cn.xiaozhou233.orangex.loader;
import cn.xiaozhou233.juiceagent.api.JuiceAgent;
import cn.xiaozhou233.orangex.loader.classloader.GameClassLoaderResolver;
import javax.swing.*;
import java.io.File;
import java.awt.*;
import java.io.PrintWriter;
import java.io.StringWriter;
public class Loader {
public static String userHome = System.getProperty("user.home");
@@ -24,7 +28,25 @@ public class Loader {
Class<?> orangeXClass = Class.forName("cn.xiaozhou233.orangex.entry.Entry", true, minecraftClassLoader);
orangeXClass.getMethod("entry").invoke(null);
} catch (Exception e) {
throw new RuntimeException(e);
StringWriter sw = new StringWriter();
PrintWriter pw = new PrintWriter(sw);
e.printStackTrace(pw);
JTextArea textArea = new JTextArea(sw.toString());
textArea.setEditable(false);
textArea.setFont(new Font(Font.MONOSPACED, Font.PLAIN, 20));
textArea.setLineWrap(false);
textArea.setCaretPosition(0);
JScrollPane scrollPane = new JScrollPane(textArea);
scrollPane.setPreferredSize(new Dimension(1000, 600));
JOptionPane.showMessageDialog(
null,
scrollPane,
"Failed to load OrangeX",
JOptionPane.ERROR_MESSAGE
);
}
System.out.println("======== Loader END ========");