From f1fb21dbb16a39df1c12544cae73b5f0f5dfa215 Mon Sep 17 00:00:00 2001 From: JeremyStarTM Date: Wed, 21 Aug 2024 01:52:32 +0200 Subject: [PATCH] Replace executeSafely with good 'ol try-catch --- .../sosengine/testapp/Main.java | 21 ++++--------------- 1 file changed, 4 insertions(+), 17 deletions(-) diff --git a/testapp/src/main/java/de/staropensource/sosengine/testapp/Main.java b/testapp/src/main/java/de/staropensource/sosengine/testapp/Main.java index 8b1ab12..90a1eea 100644 --- a/testapp/src/main/java/de/staropensource/sosengine/testapp/Main.java +++ b/testapp/src/main/java/de/staropensource/sosengine/testapp/Main.java @@ -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); + } } /**