From 0fba4510dfdc5413b711a1a02b2f6d7fba14b9fd Mon Sep 17 00:00:00 2001 From: Bixilon Date: Sun, 22 Nov 2020 19:40:59 +0100 Subject: [PATCH] Handle all mod loading exceptions --- .../de/bixilon/minosoft/modding/loading/ModLoader.java | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/src/main/java/de/bixilon/minosoft/modding/loading/ModLoader.java b/src/main/java/de/bixilon/minosoft/modding/loading/ModLoader.java index eb12dd05f..67ee51c6e 100644 --- a/src/main/java/de/bixilon/minosoft/modding/loading/ModLoader.java +++ b/src/main/java/de/bixilon/minosoft/modding/loading/ModLoader.java @@ -23,7 +23,6 @@ import org.xeustechnologies.jcl.JarClassLoader; import org.xeustechnologies.jcl.JclObjectFactory; import java.io.File; -import java.io.IOException; import java.util.LinkedList; import java.util.concurrent.CountDownLatch; import java.util.concurrent.ExecutorService; @@ -87,7 +86,12 @@ public class ModLoader { progress.countDown(); return; } - if (!instance.start(phase)) { + try { + if (!instance.start(phase)) { + throw new ModLoadingException(String.format("Could not load nod %s", instance.getInfo())); + } + } catch (Throwable e) { + e.printStackTrace(); Log.warn(String.format("An error occurred while loading %s", instance.getInfo())); instance.setEnabled(false); } @@ -127,7 +131,7 @@ public class ModLoader { instance.setInfo(modInfo); Log.verbose(String.format("[MOD] Mod file loaded and added to classpath (%s)", modInfo)); zipFile.close(); - } catch (IOException | ModLoadingException | NullPointerException e) { + } catch (Throwable e) { instance = null; e.printStackTrace(); Log.warn(String.format("Could not load mod: %s", file.getAbsolutePath()));