From f39e9f7022a0102a608861e48bfe0fc2559b497e Mon Sep 17 00:00:00 2001 From: SimonC4 Date: Thu, 6 Aug 2015 19:03:02 +1200 Subject: [PATCH] Display a message box with the error as to why the game didn't start. --- .../src/com/miloshpetrov/sol2/desktop/SolDesktop.java | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/desktop/src/com/miloshpetrov/sol2/desktop/SolDesktop.java b/desktop/src/com/miloshpetrov/sol2/desktop/SolDesktop.java index 8b6ec311f..c0913f753 100644 --- a/desktop/src/com/miloshpetrov/sol2/desktop/SolDesktop.java +++ b/desktop/src/com/miloshpetrov/sol2/desktop/SolDesktop.java @@ -9,6 +9,7 @@ import com.miloshpetrov.sol2.SolFileReader; import com.miloshpetrov.sol2.game.DebugOptions; import com.miloshpetrov.sol2.soundtest.SoundTestListener; +import org.lwjgl.Sys; import java.io.BufferedReader; import java.io.FileReader; @@ -54,6 +55,14 @@ public static void main(String[] argv) { c.addIcon(DebugOptions.DEV_ROOT_PATH + "res/icon.png", Files.FileType.Absolute); } + Thread.setDefaultUncaughtExceptionHandler(new Thread.UncaughtExceptionHandler() { + @Override + public void uncaughtException (Thread thread, final Throwable ex) { + System.err.println("Critical Failure" + ex.getLocalizedMessage()); + Sys.alert("Critical Failure", ex.getLocalizedMessage()); + } + }); + new LwjglApplication(new SolApplication(), c); }