Iris
Iris copied to clipboard
Do not hotload when there's an error with the pack
Adding, Removing, or Changing
Changing
Type of Modification
I want to not hotload (keep earlier V) when the pack gives errors, such as parsing errors.
What are you trying to modify
The way I would implement this is by checking each JSON file by importing it, seeing if it throws an exception. If you want to keep this simple/non-intelligent just do not import when any file has an error, and send the file's name to the console when it does. If you want to make it a bit smarter you can track which files are not needed, i.e. if someone is making a new biome and it's not used yet, you can still hotload, just without the biome.
Alternatives
If this could not be implemented I would have to wait for the errors to subside every time it hotloads while I'm making changes. VSCode autosaves, and I like that about VSCode, so this shit happens all the time :[
There is no way to validate without causing an error lol
Loading json files throws a jsonformatexception when they're busted, you can catch that, print the name of the file it's happened in, and skip the hotload.