Added new tryCatch wrapper

This commit is contained in:
2025-03-20 23:41:18 +01:00
parent e555417e13
commit 95f9bb723f
16 changed files with 255 additions and 269 deletions

View File

@@ -4,6 +4,7 @@ import { addWaitingList, getWaitingLists, removeWaitingList } from "src/drizzle/
import { embedColor, hypixelGuildID, waitingListChannel, waitingListMessage } from "~/config/options"
import { waitingListRole } from "~/config/roles"
import { IButton } from "~/typings"
import tryCatch from "~/utils/Functions/trycatch"
import { getGuild, getIGN } from "~/utils/Hypixel"
import { log } from "~/utils/Logger"
@@ -82,7 +83,11 @@ export default {
})
if (process.env.NODE_ENV === "dev") return
try {
const [error] = await tryCatch(updateWaitingList())
if (error) return log("Error while trying to update waiting list.", "error")
async function updateWaitingList() {
const channel = guild.channels.cache.get(waitingListChannel) as TextChannel
const wlmessage = await channel!.messages.fetch(waitingListMessage)
@@ -125,12 +130,6 @@ export default {
timestamp: new Date().toISOString()
}]
})
// eslint-disable-next-line @typescript-eslint/no-unused-vars
} catch (err) {
log(
"Error while trying to update waiting list.",
"error"
)
}
}
} as IButton