#try/catch with JsonIO.read not being caught on fail

6 messages · Page 1 of 1 (latest)

shut python
#

Quick question, I'm trying to use JsonIO.read to see if there's a model file for a block already created in a block.registry event, but when I do the check for it, it doesn't throw a err, am I doing something wrong?

try {
  console.log(`Attempting load of model info...`);
  let cache = JsonIO.read(`kubejs/assets/kubejs/models/block/${metalInfo[0]}_${ItemID}_${b}.json`);
} catch (err) {
  console.log(`Error: Model File doesn't exist, creating... (Err): ${err}`);
  JsonIO.write(`kubejs/assets/kubejs/models/block/${metalInfo[0]}_${ItemID}_${b}.json`, JsonData);
}

I see Attempting load of model info.. in the logs, but I don't see the Error: line, and it can't be reading anything, cause it doesn't exist. It just fail quietly, did I mess something up?

feral depotBOT
#

Once your ticket has been resolved, please close it with </ticket close:1054771505520717835> command!

ornate epochBOT
#

[Quote ➤](#1102860211238227988 message) yeah try cathc doesnt work with rhino

shut python
#

Ah, ok. I saw something about ichor, I can't seem to find much about it, or any documentation, is it something that's supported yet/is there any documentation for it?

slate plinth
#

Ichor is Lat's self written from scratch interpreter that will replace Rhino in KJS7/1.20

shut python
#

Ah, ok. Thank you for the help!