Replace executeSafely with good 'ol try-catch
Some checks failed
build-and-test / build (push) Failing after 3m1s
build-and-test / test (push) Failing after 2m58s
build-and-test / generate-javadoc (push) Failing after 3m3s

This commit is contained in:
JeremyStar™ 2024-08-21 01:52:32 +02:00
parent 5284dfe17b
commit f1fb21dbb1
Signed by: JeremyStarTM
GPG key ID: E366BAEF67E4704D

View file

@ -22,12 +22,10 @@ package de.staropensource.sosengine.testapp;
import de.staropensource.sosengine.base.Engine;
import de.staropensource.sosengine.base.annotations.EventListener;
import de.staropensource.sosengine.base.data.versioning.OneNumberVersioningSystem;
import de.staropensource.sosengine.base.events.ThrowableCatchEvent;
import de.staropensource.sosengine.base.logging.LoggerInstance;
import de.staropensource.sosengine.base.types.DependencyVector;
import de.staropensource.sosengine.base.types.vectors.Vec2i;
import de.staropensource.sosengine.base.utility.DependencyResolver;
import de.staropensource.sosengine.base.utility.Miscellaneous;
import de.staropensource.sosengine.base.utility.parser.StackTraceParser;
import de.staropensource.sosengine.windowing.WindowingSubsystem;
import de.staropensource.sosengine.windowing.classes.Window;
@ -119,7 +117,7 @@ public final class Main {
*/
@SneakyThrows
public void run() {
Miscellaneous.executeSafely(() -> {
try {
// Initialize sos!engine
engine = new Engine();
@ -223,20 +221,9 @@ public final class Main {
}
logger.crash(message.toString());
}, "mainThread");
}
/**
* Crashes the application when a throwable
* is thrown in {@link #run()}.
*
* @since v1-alpha2
*/
@EventListener(event = ThrowableCatchEvent.class)
@SuppressWarnings({ "unused" })
private static void onThrowable(@NotNull Throwable throwable, @NotNull String identifier) {
if (identifier.equals("mainThread") && instance != null)
instance.logger.crash("The main thread threw an exception", throwable);
} catch (Exception exception) {
logger.crash("The main thread threw an exception", exception);
}
}
/**