Skip to content

Commit 034701c

Browse files
committed
Better error handling (fixes invalid mo codec)
1 parent 405391c commit 034701c

3 files changed

Lines changed: 5 additions & 5 deletions

File tree

common/src/main/java/com/faboslav/structurify/common/registry/StructurifyTemplatePoolProvider.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -141,7 +141,7 @@ private static Set<String> loadStructureTemplatePoolsForStructure(ResourceManage
141141
return structureTemplatePools.stream()
142142
.map(Identifier::toString)
143143
.collect(java.util.stream.Collectors.toCollection(LinkedHashSet::new));
144-
} catch(Exception e) {
144+
} catch(Throwable e) {
145145
// TODO log error
146146
return Set.of();
147147
}

common/src/main/java/com/faboslav/structurify/common/util/FileUtil.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ public class FileUtil
1616
public static Optional<ModIconInfo> getModIconInfo(String id, Optional<String> iconPath, Optional<Path> path) {
1717
try(var stream = Files.newInputStream(path.orElseThrow())) {
1818
return getModIconInfo(id, iconPath, stream);
19-
} catch(Exception exception) {
19+
} catch(Throwable exception) {
2020
return Optional.empty();
2121
}
2222
}
@@ -36,7 +36,7 @@ public static Optional<ModIconInfo> getModIconInfo(String id, Optional<String> i
3636
.getTextureManager()
3737
.register(textureId, texture);
3838
return Optional.of(new ModIconInfo(textureId, width, height));
39-
} catch(Exception exception) {
39+
} catch(Throwable exception) {
4040
return Optional.empty();
4141
}
4242
}

common/src/main/java/com/faboslav/structurify/common/util/JigsawStructureUtil.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ public static JsonObject getStructureData(Structure structure) {
4343
.filter(JsonElement::isJsonObject)
4444
.map(JsonElement::getAsJsonObject)
4545
.orElseThrow();
46-
} catch(Exception exception) {
46+
} catch(Throwable exception) {
4747
try {
4848
//? if >= 1.21.1 {
4949
return JigsawStructure.CODEC.codec()
@@ -55,7 +55,7 @@ public static JsonObject getStructureData(Structure structure) {
5555
.filter(JsonElement::isJsonObject)
5656
.map(JsonElement::getAsJsonObject)
5757
.orElseThrow();
58-
} catch (Exception ignored) {
58+
} catch (Throwable ignored) {
5959
}
6060

6161
return null;

0 commit comments

Comments
 (0)