Only catch Exceptions not Errors (#1186)

This commit is contained in:
glowredman authored and GitHub committed 2025-12-21 14:14:50 +01:00
1 parent 941fc88484
commit a32f9ca244
20 files changed
+45 -39

No files matched your search

@@ -55,8 +55,10 @@ public class BackhandReflectionCompat {
if (isLoaded && renderOffhandReturn != null) {
try {
renderOffhandReturn.invokeExact(partialTicks);
} catch (Throwable e) {
LOGGER.error("Failed to invoke Backhand renderOffhandReturn", e);
} catch (Error e) {
throw e;
} catch (Throwable t) {
LOGGER.error("Failed to invoke HoloInventory renderEvent", t);
isLoaded = false;
}
}
@@ -66,8 +68,10 @@ public class BackhandReflectionCompat {
if (isLoaded && getOffhandItem != null) {
try {
return (ItemStack) getOffhandItem.invokeExact(player);
} catch (Throwable e) {
LOGGER.error("Failed to invoke Backhand getOffhandItem", e);
} catch (Error e) {
throw e;
} catch (Throwable t) {
LOGGER.error("Failed to invoke HoloInventory renderEvent", t);
isLoaded = false;
}
}
@@ -75,8 +75,10 @@ public class HoloInventoryReflectionCompat {
} else {
renderEventMethod.invokeExact(event);
}
} catch (Throwable e) {
LOGGER.error("Failed to invoke HoloInventory renderEvent", e);
} catch (Error e) {
throw e;
} catch (Throwable t) {
LOGGER.error("Failed to invoke HoloInventory renderEvent", t);
isLoaded = false;
}
}
@@ -85,8 +87,10 @@ public class HoloInventoryReflectionCompat {
if (!isLoaded) return;
try {
angelicaOverrideSetter.invokeExact(value);
} catch (Throwable e) {
LOGGER.error("Failed to set HoloInventory angelicaOverride", e);
} catch (Error e) {
throw e;
} catch (Throwable t) {
LOGGER.error("Failed to invoke HoloInventory renderEvent", t);
isLoaded = false;
}
}
@@ -129,7 +129,7 @@ public class ColorizeBlock {
static {
try {
reset();
} catch (Throwable e) {
} catch (Exception e) {
e.printStackTrace();
}
}
@@ -46,7 +46,7 @@ public class ColorizeEntity {
static {
try {
reset();
} catch (Throwable e) {
} catch (Exception e) {
e.printStackTrace();
}
}
@@ -36,7 +36,7 @@ public class ColorizeItem {
static {
try {
reset();
} catch (Throwable e) {
} catch (Exception e) {
e.printStackTrace();
}
}
@@ -63,7 +63,7 @@ public class ColorizeWorld {
static {
try {
reset();
} catch (Throwable e) {
} catch (Exception e) {
e.printStackTrace();
}
}
@@ -35,7 +35,7 @@ public class Colorizer {
static {
try {
reset();
} catch (Throwable e) {
} catch (Exception e) {
e.printStackTrace();
}
TexturePackChangeHandler.register(new TexturePackChangeHandler(MCPatcherUtils.CUSTOM_COLORS, 2) {
@@ -77,7 +77,7 @@ class PotionReplacer {
i);
}
}
} catch (Throwable e) {
} catch (Exception e) {
e.printStackTrace();
}
}
@@ -50,7 +50,7 @@ public class BlockFaceMatcher {
if (!matcher.isAll()) {
return matcher;
}
} catch (Throwable e) {
} catch (Exception e) {
e.printStackTrace();
}
}
@@ -49,7 +49,7 @@ public class CTMUtils {
Class.forName(MCPatcherUtils.RENDER_PASS_CLASS)
.getMethod("finish")
.invoke(null);
} catch (Throwable ignore) {}
} catch (Exception ignore) {}
TexturePackChangeHandler.register(new TexturePackChangeHandler(MCPatcherUtils.CONNECTED_TEXTURES, 3) {
@@ -61,9 +61,7 @@ public class CTMUtils {
RenderPassAPI.instance.clear();
try {
GlassPaneRenderer.clear();
} catch (NoClassDefFoundError e) {
// nothing
} catch (Throwable e) {
} catch (Exception e) {
e.printStackTrace();
}
renderBlockState.clear();
@@ -87,7 +87,7 @@ public class CustomAnimation implements Comparable<CustomAnimation> {
if (!pending.isEmpty()) {
try {
checkPendingAnimations();
} catch (Throwable e) {
} catch (Exception e) {
e.printStackTrace();
logger.error("%d remaining animations cleared", pending.size());
pending.clear();
@@ -219,7 +219,7 @@ public class FancyDial {
return instance;
}
instance.finish();
} catch (Throwable e) {
} catch (Exception e) {
e.printStackTrace();
}
return null;
@@ -410,7 +410,7 @@ public class FancyDial {
}
ImageIO.write(image, "png", path);
logger.info("wrote %dx%d %s", image.getWidth(), image.getHeight(), path.getPath());
} catch (Throwable e) {
} catch (Exception e) {
e.printStackTrace();
}
}
@@ -143,7 +143,7 @@ public class FontUtils {
boolean[] isOverride = new boolean[charWidth.length];
try {
getCharWidthOverrides(filename, charWidthf, isOverride);
} catch (Throwable e) {
} catch (Exception e) {
e.printStackTrace();
}
if (!isOverride[32]) {
@@ -47,7 +47,7 @@ abstract public class NBTRule {
} else {
return new Exact(tag, value);
}
} catch (Throwable e) {
} catch (Exception e) {
e.printStackTrace();
return null;
}
@@ -204,7 +204,7 @@ abstract public class NBTRule {
if (result != null && cl.isAssignableFrom(result.getClass())) {
return cl.cast(result);
}
} catch (Throwable e) {}
} catch (Exception e) {}
return null;
}
@@ -104,7 +104,7 @@ public class ResourceList {
try {
zipFile = new ZipFile(jar);
scanZipFile(zipFile);
} catch (Throwable e) {
} catch (Exception e) {
e.printStackTrace();
} finally {
MCPatcherUtils.close(zipFile);
@@ -55,7 +55,7 @@ abstract public class TexturePackChangeHandler implements Comparable<TexturePack
try {
logger.info("initializing %s...", handler.name);
handler.initialize();
} catch (Throwable e) {
} catch (Exception e) {
e.printStackTrace();
logger.severe("%s initialization failed", handler.name);
}
@@ -72,7 +72,7 @@ abstract public class TexturePackChangeHandler implements Comparable<TexturePack
try {
logger.info("refreshing %s...", handler.name);
handler.refresh();
} catch (Throwable e) {
} catch (Exception e) {
e.printStackTrace();
logger.severe("%s refresh failed", handler.name);
}
@@ -105,7 +105,7 @@ abstract public class TexturePackChangeHandler implements Comparable<TexturePack
try {
logger.info("refreshing %s (pre)...", handler.name);
handler.beforeChange();
} catch (Throwable e) {
} catch (Exception e) {
e.printStackTrace();
logger.severe("%s.beforeChange failed", handler.name);
}
@@ -123,7 +123,7 @@ abstract public class TexturePackChangeHandler implements Comparable<TexturePack
try {
logger.info("refreshing %s (post)...", handler.name);
handler.afterChange();
} catch (Throwable e) {
} catch (Exception e) {
e.printStackTrace();
logger.severe("%s.afterChange failed", handler.name);
}
@@ -133,7 +133,7 @@ abstract public class TexturePackChangeHandler implements Comparable<TexturePack
TexturePackChangeHandler handler = handlers.get(i);
try {
handler.afterChange2();
} catch (Throwable e) {
} catch (Exception e) {
e.printStackTrace();
logger.severe("%s.afterChange2 failed", handler.name);
}