From a16a085f753e404f707e6f1f6137a209d3ce4200 Mon Sep 17 00:00:00 2001 From: KennyTV Date: Thu, 16 Jul 2020 19:27:56 +0200 Subject: [PATCH] Print exceptions during mapping loading --- .../ViaVersion/api/protocol/ProtocolRegistry.java | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/common/src/main/java/us/myles/ViaVersion/api/protocol/ProtocolRegistry.java b/common/src/main/java/us/myles/ViaVersion/api/protocol/ProtocolRegistry.java index 2da936395..d38b14954 100644 --- a/common/src/main/java/us/myles/ViaVersion/api/protocol/ProtocolRegistry.java +++ b/common/src/main/java/us/myles/ViaVersion/api/protocol/ProtocolRegistry.java @@ -381,14 +381,23 @@ public class ProtocolRegistry { public static void addMappingLoaderFuture(Class protocolClass, Runnable runnable) { synchronized (MAPPING_LOADER_LOCK) { - CompletableFuture future = CompletableFuture.runAsync(runnable, mappingLoaderExecutor); + CompletableFuture future = CompletableFuture.runAsync(runnable, mappingLoaderExecutor).exceptionally(throwable -> { + Via.getPlatform().getLogger().severe("Error during mapping loading of " + protocolClass.getSimpleName()); + throwable.printStackTrace(); + return null; + }); mappingLoaderFutures.put(protocolClass, future); } } public static void addMappingLoaderFuture(Class protocolClass, Class dependsOn, Runnable runnable) { synchronized (MAPPING_LOADER_LOCK) { - CompletableFuture future = getMappingLoaderFuture(dependsOn).whenCompleteAsync((v, throwable) -> runnable.run(), mappingLoaderExecutor); + CompletableFuture future = getMappingLoaderFuture(dependsOn) + .whenCompleteAsync((v, throwable) -> runnable.run(), mappingLoaderExecutor).exceptionally(throwable -> { + Via.getPlatform().getLogger().severe("Error during mapping loading of " + protocolClass.getSimpleName()); + throwable.printStackTrace(); + return null; + }); mappingLoaderFutures.put(protocolClass, future); } }