also catch startup exceptions

This commit is contained in:
yugecin 2017-01-15 00:21:52 +01:00
parent 4f10577321
commit 88676f2c36

View File

@ -23,7 +23,6 @@ import itdelatrisu.opsu.Utils;
import itdelatrisu.opsu.db.DBController; import itdelatrisu.opsu.db.DBController;
import itdelatrisu.opsu.downloads.DownloadList; import itdelatrisu.opsu.downloads.DownloadList;
import itdelatrisu.opsu.downloads.Updater; import itdelatrisu.opsu.downloads.Updater;
import org.lwjgl.LWJGLException;
import org.newdawn.slick.util.Log; import org.newdawn.slick.util.Log;
import yugecin.opsudance.core.DisplayContainer; import yugecin.opsudance.core.DisplayContainer;
import yugecin.opsudance.errorhandling.ErrorHandler; import yugecin.opsudance.errorhandling.ErrorHandler;
@ -52,18 +51,22 @@ public class OpsuDance {
} }
public void start(String[] args) { public void start(String[] args) {
sout("initialized"); try {
sout("initialized");
checkRunningDirectory(); checkRunningDirectory();
Options.parseOptions(); Options.parseOptions();
ensureSingleInstance(); ensureSingleInstance();
sout("prechecks done and options parsed"); sout("prechecks done and options parsed");
initDatabase(); initDatabase();
initUpdater(args); initUpdater(args);
sout("database & updater initialized"); sout("database & updater initialized");
container.demux.switchStateNow(EmptyState.class); container.demux.switchStateNow(EmptyState.class);
} catch (Exception e) {
errorAndExit("startup failure", e);
}
while (rungame()); while (rungame());
@ -75,9 +78,8 @@ public class OpsuDance {
private boolean rungame() { private boolean rungame() {
try { try {
container.setup(); container.setup();
} catch (LWJGLException e) { } catch (Exception e) {
ErrorHandler.error("could not initialize GL", e).preventContinue().show(); errorAndExit("could not initialize GL", e);
System.exit(1);
} }
Exception caughtException = null; Exception caughtException = null;
try { try {