Iris icon indicating copy to clipboard operation
Iris copied to clipboard

Do not hotload when there's an error with the pack

Open svdgoor opened this issue 2 years ago • 2 comments

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 :[

svdgoor avatar Aug 13 '22 13:08 svdgoor

There is no way to validate without causing an error lol

NextdoorPsycho avatar Aug 16 '22 18:08 NextdoorPsycho

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.

svdgoor avatar Aug 16 '22 18:08 svdgoor