Skip to content

Commit

Permalink
Improved uncaught exception handler
Browse files Browse the repository at this point in the history
  • Loading branch information
rzats committed Apr 9, 2016
1 parent 2599251 commit 361e0ef
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions desktop/src/org/destinationsol/desktop/SolDesktop.java
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import com.badlogic.gdx.Files;
import com.badlogic.gdx.backends.lwjgl.LwjglApplication;
import com.badlogic.gdx.backends.lwjgl.LwjglApplicationConfiguration;
import com.google.common.base.Throwables;
import org.destinationsol.GameOptions;
import org.destinationsol.SolApplication;
import org.destinationsol.SolFileReader;
Expand Down Expand Up @@ -56,9 +57,10 @@ public static void main(String[] argv) {

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());
public void uncaughtException(Thread thread, final Throwable ex) {
String exceptionString = Throwables.getStackTraceAsString(ex) + "Message: " + ex.getLocalizedMessage();
System.err.println("Uncaught exception: " + exceptionString);
Sys.alert("Uncaught Exception", exceptionString);
}
});

Expand Down

0 comments on commit 361e0ef

Please sign in to comment.