Alerting if there is conflict

I'm doing an insert and wanted to ask whether there is a specific error type that is returned when there is a conflict. Pseudo-code of what I would want
await db.insert(guild).values({ id: interaction.guildId })
.catch((error) => {
if (error.type === "conflict") {
alert("This already exists")
}
})
await db.insert(guild).values({ id: interaction.guildId })
.catch((error) => {
if (error.type === "conflict") {
alert("This already exists")
}
})
2 Replies
net-tech-
net-tech-OP15mo ago
bump
pandareaper
pandareaper15mo ago
in my experience, the error you get will be from whatever DB driver you are using under the hood, not drizzle
Want results from more Discord servers?
Add your server