Added new tryCatch wrapper
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user