Encapsulate Main#run logic in try-catch block

This commit is contained in:
JeremyStar™ 2024-07-21 23:18:13 +02:00
parent b277587ec8
commit bca45488d1
Signed by: JeremyStarTM
GPG key ID: E366BAEF67E4704D
2 changed files with 50 additions and 43 deletions

View file

@ -1,23 +1,25 @@
/* /*
STAROPENSOURCE ENGINE SOURCE FILE * STAROPENSOURCE ENGINE SOURCE FILE
Copyright (c) 2024 The StarOpenSource Engine Contributors * Copyright (c) 2024 The StarOpenSource Engine Contributors
Licensed under the GNU Affero General Public License v3 * Licensed under the GNU Affero General Public License v3
*
This program is free software: you can redistribute it and/or modify * This program is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License as * it under the terms of the GNU Affero General Public License as
published by the Free Software Foundation, either version 3 of the * published by the Free Software Foundation, either version 3 of the
License, or (at your option) any later version. * License, or (at your option) any later version.
*
This program is distributed in the hope that it will be useful, * This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Affero General Public License for more details. * GNU Affero General Public License for more details.
*
You should have received a copy of the GNU Affero General Public License * You should have received a copy of the GNU Affero General Public License
along with this program. If not, see <https://www.gnu.org/licenses/>. * along with this program. If not, see <https://www.gnu.org/licenses/>.
*/ */
/** /**
* Contains the code required for drawing things to a screen. * Contains the code required for drawing things to a screen.
*
* @since v1-alpha0
*/ */
package de.staropensource.sosengine.graphics; package de.staropensource.sosengine.graphics;

View file

@ -96,6 +96,7 @@ public class Main {
*/ */
@SneakyThrows @SneakyThrows
public void run(String[] args) { public void run(String[] args) {
try {
// Initialize sos!engine // Initialize sos!engine
engine = new Engine(); engine = new Engine();
@ -126,5 +127,9 @@ public class Main {
// Shutdown // Shutdown
Engine.getInstance().shutdown(0); Engine.getInstance().shutdown(0);
} catch (Throwable throwable) {
Thread.ofVirtual().start(() -> Engine.getInstance().shutdown(69));
throw throwable;
}
} }
} }