Skip to content

Commit

Permalink
add second layer of try catch here too
Browse files Browse the repository at this point in the history
  • Loading branch information
Raycoms committed Aug 19, 2024
1 parent cf88860 commit a5cd066
Showing 1 changed file with 12 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -62,19 +62,27 @@ private LootTableAnalyzer() { }
/**
* Evaluate a loot table and report possible drops.
*
* @param provider the registry provider
* @param provider the registry provider
* @param lootTableId the loot table id
* @return the list of possible drops
*/
public static List<LootDrop> toDrops(final HolderLookup.Provider provider, @NotNull final ResourceKey<LootTable> lootTableId)
{
return toDrops(provider, provider.holderOrThrow(lootTableId));
try
{
return toDrops(provider, provider.holderOrThrow(lootTableId));
}
catch (final JsonParseException ex)
{
Log.getLogger().error(String.format("Failed to parse loot table from %s", lootTableId), ex);
return Collections.emptyList();
}
}

/**
* Evaluate a loot table and report possible drops.
*
* @param provider the registry provider
* @param provider the registry provider
* @param lootTable the loot table
* @return the list of possible drops
*/
Expand All @@ -87,13 +95,11 @@ public static List<LootDrop> toDrops(@NotNull final HolderLookup.Provider provid
}
catch (final JsonParseException ex)
{
Log.getLogger().error(String.format("Failed to parse loot table from %s",
lootTable.getKey()), ex);
Log.getLogger().error(String.format("Failed to parse loot table from %s", lootTable.getKey()), ex);
return Collections.emptyList();
}
}


/**
* Evaluate a loot table and report possible drops.
*
Expand Down

0 comments on commit a5cd066

Please sign in to comment.