Skip to content

Commit

Permalink
Improve logging
Browse files Browse the repository at this point in the history
  • Loading branch information
lukebemish committed Dec 4, 2023
1 parent aeb8435 commit 186d9c1
Showing 1 changed file with 6 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,9 @@ private static boolean checkZipForMeta(Path path) {
JsonObject object = DefaultResources.GSON.fromJson(new InputStreamReader(reader), JsonObject.class);
JsonElement meta = object.get(DefaultResources.MOD_ID);
var result = DefaultResourcesMetadataSection.CODEC.parse(JsonOps.INSTANCE, meta);
if (result.error().isPresent()) {
DefaultResources.LOGGER.error("Could not read metadata of {} for resource pack detection; ignoring: {}", path.getFileName(), result.error().get());
}
return result.result().isPresent() && result.result().get().detect();
}
} catch (Exception e) {
Expand All @@ -125,6 +128,9 @@ private static boolean checkPathForMeta(Path path) {
JsonObject object = DefaultResources.GSON.fromJson(reader, JsonObject.class);
JsonElement meta = object.get(DefaultResources.MOD_ID);
var result = DefaultResourcesMetadataSection.CODEC.parse(JsonOps.INSTANCE, meta);
if (result.error().isPresent()) {
DefaultResources.LOGGER.error("Could not read metadata of {} for resource pack detection; ignoring: {}", path.getFileName(), result.error().get());
}
return result.result().isPresent() && result.result().get().detect();
} catch (Exception e) {
DefaultResources.LOGGER.error("Could not read {} for resource pack detection; ignoring.", path.getFileName(), e);
Expand Down

0 comments on commit 186d9c1

Please sign in to comment.