#Where are these messages being logged to?

29 messages · Page 1 of 1 (latest)

lofty jolt
#
global.itemBlacklist.forEach(item=>{
    try {
    event.add('randomium:blacklist', item)
    } catch (exception) {
        console.warn(`Failed to add \"randomium:blacklist\" tag to ${item} from item blacklist`)
    }
})
global.randomiumBlacklist.forEach(item=>{
    try {
    event.add('randomium:blacklist', item)
    } catch (exception) {
        console.warn(`Failed to add \"randomium:blacklist\" tag to ${item} from randomium blacklist`)
    }
})

I added some fake items to the array and I can't find the messages
Without the try catch blocks it causes a kubejs error

night fieldBOT
#

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

lean frost
#

In which Event is this

lofty jolt
#

onEvent('item.tags', event => {

#

Sorry, my bad for not sharing that

#

removing the try catch blocks causes this to happen

lean frost
#

What Error do you get withotu the try catch

opaque crystalBOT
#

You can find your KubeJS server log in /minecraft/logs/kubejs/server.log.
If you are on 1.18 or below it will be called server.txt.
Please send it if asked, as it contains helpful information.

lofty jolt
#

The server log is quite huge

#

since there's a log of other scripts being run in server scripts

opaque crystalBOT
#

The IllegalStateException error in the tag event means that the item (or anything else) that you're trying to add the tag to doesn't exist.

lofty jolt
#

Yes

#

That's why I added the try catch block

#

but I'm still trying to log the error while using the try catch block

lean frost
#

Those should Go into Server.txt

lofty jolt
#

Let me run it again with the try catch blocks then

opaque crystalBOT
#

Paste version of server.txt from @lofty jolt

lofty jolt
#

What happened to this line of code?

console.warn(`Failed to add \"randomium:blacklist\" tag to ${item} from item blacklist`)
#

Why can't I see the message being logged?

#

Actually, with further testing, the try catch block isn't even working properly

#

How can I check if an item id exists?

lean frost
#

Item.exists("item")

cunning nest
#
onEvent('tags.items', event => {
    event.add("randomium:blacklist", global.itemBlacklist);
});

That should work if global.itemBlacklist is an array...

#

It's just adding tags, it shouldn't matter if the item exists.

lofty jolt
#

I guess I can close this issue. Try catch blocks don't seem to work correctly in Kubejs