KubeJS

KubeJS

83M Downloads

Better error handling when recipes fail

pietro-lopes opened this issue ยท 1 comments

commented

There are some issues here, like when a component fail to parse it, it does NOT fallback to vanilla, it is simply ignored and no description at all.

} catch (InvalidRecipeComponentException ignore) {
} catch (Throwable ex) {
if (DevProperties.get().logErroringRecipes) {
ConsoleJS.SERVER.warn("Failed to parse recipe '" + recipeIdAndType + "'" + stack.atString() + "! Falling back to vanilla", ex, POST_SKIP_ERROR);
}
try {
originalRecipes.put(recipeId, UnknownRecipeSchema.SCHEMA.deserialize(SourceLine.UNKNOWN, type, recipeId, json));
} catch (NullPointerException | IllegalArgumentException | JsonParseException ex2) {
if (DevProperties.get().logErroringRecipes) {
ConsoleJS.SERVER.warn("Failed to parse recipe " + recipeIdAndType + stack.atString(), ex2, POST_SKIP_ERROR);
}
} catch (Exception ex3) {
ConsoleJS.SERVER.warn("Failed to parse recipe " + recipeIdAndType + stack.atString(), ex3, POST_SKIP_ERROR);
}
}

And IMO when a fallback to vanilla also fails, I think it should be logged as error, not warning when DevProperties.get().logErroringRecipes is ON.

commented

Example on SilentGear that implements some sort of custom ingredient that is not ready yet when kubejs parses recipes.
Without the following script:

Image

When adding the following script:

ServerEvents.recipes(event => {
	event.forEachRecipe({input: "acacia_boat"}, r => {})
})
Image